You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fixed leak in ma_tls_read/write
This commit is contained in:
@@ -1745,7 +1745,7 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
free(s_passwd);
|
free(s_passwd);
|
||||||
free(s_db);
|
free(s_db);
|
||||||
|
|
||||||
if (db && !(mysql->db= strdup(db)))
|
if (!mysql->db && db && !(mysql->db= strdup(db)))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
rc= 1;
|
rc= 1;
|
||||||
|
@@ -719,15 +719,14 @@ ssize_t ma_tls_write_async(MARIADB_PVIO *pvio,
|
|||||||
ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
|
ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
|
||||||
{
|
{
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
MYSQL *mysql= (MYSQL *)SSL_get_app_data(ctls->ssl);
|
MARIADB_PVIO *pvio= ctls->pvio;
|
||||||
MARIADB_PVIO *pvio= mysql->net.pvio;
|
|
||||||
|
|
||||||
while ((rc= SSL_read((SSL *)ctls->ssl, (void *)buffer, (int)length)) < 0)
|
while ((rc= SSL_read((SSL *)ctls->ssl, (void *)buffer, (int)length)) < 0)
|
||||||
{
|
{
|
||||||
int error= SSL_get_error((SSL *)ctls->ssl, rc);
|
int error= SSL_get_error((SSL *)ctls->ssl, rc);
|
||||||
if (error != SSL_ERROR_WANT_READ)
|
if (error != SSL_ERROR_WANT_READ)
|
||||||
return rc;
|
return rc;
|
||||||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.read_timeout) < 1)
|
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.read_timeout) < 1)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@@ -736,15 +735,14 @@ ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
|
|||||||
ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
|
ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
|
||||||
{
|
{
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
MYSQL *mysql= (MYSQL *)SSL_get_app_data(ctls->ssl);
|
MARIADB_PVIO *pvio= ctls->pvio;
|
||||||
MARIADB_PVIO *pvio= mysql->net.pvio;
|
|
||||||
|
|
||||||
while ((rc= SSL_write((SSL *)ctls->ssl, (void *)buffer, (int)length)) <= 0)
|
while ((rc= SSL_write((SSL *)ctls->ssl, (void *)buffer, (int)length)) <= 0)
|
||||||
{
|
{
|
||||||
int error= SSL_get_error((SSL *)ctls->ssl, rc);
|
int error= SSL_get_error((SSL *)ctls->ssl, rc);
|
||||||
if (error != SSL_ERROR_WANT_WRITE)
|
if (error != SSL_ERROR_WANT_WRITE)
|
||||||
return rc;
|
return rc;
|
||||||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.write_timeout) < 1)
|
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.write_timeout) < 1)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -1084,6 +1084,7 @@ static int test_auth256(MYSQL *my)
|
|||||||
if (!mysql_client_find_plugin(mysql, "sha256_password", 3))
|
if (!mysql_client_find_plugin(mysql, "sha256_password", 3))
|
||||||
{
|
{
|
||||||
diag("sha256_password plugin not available");
|
diag("sha256_password plugin not available");
|
||||||
|
mysql_close(mysql);
|
||||||
return SKIP;
|
return SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1097,6 +1098,7 @@ static int test_auth256(MYSQL *my)
|
|||||||
if (!num_rows)
|
if (!num_rows)
|
||||||
{
|
{
|
||||||
diag("server doesn't support sha256 authentication");
|
diag("server doesn't support sha256 authentication");
|
||||||
|
mysql_close(mysql);
|
||||||
return SKIP;
|
return SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user