Skip to content

Commit

Permalink
Fix SSL_read/write return value checking in ma_tls_async_check_result
Browse files Browse the repository at this point in the history
SSL_{read,write}'s return values == 0 signify the operation was
unsuccessful, but here it's being treated as success. Other calls of
these functions already properly checks the return value.

Signed-off-by: Josh Hunt <johunt@akamai.com>
  • Loading branch information
geauxbears authored and 9EOR9 committed Apr 29, 2024
1 parent 89d11c8 commit 4c1c7f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libmariadb/mariadb_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ my_ssl_async_check_result(int res, struct mysql_async_context *b, MARIADB_SSL *c
{
int ssl_err;
b->events_to_wait_for= 0;
if (res >= 0)
if (res > 0)
return 1;
ssl_err= SSL_get_error(ssl, res);
if (ssl_err == SSL_ERROR_WANT_READ)
Expand Down
2 changes: 1 addition & 1 deletion libmariadb/secure/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ ma_tls_async_check_result(int res, struct mysql_async_context *b, SSL *ssl)
{
int ssl_err;
b->events_to_wait_for= 0;
if (res >= 0)
if (res > 0)
return 1;
ssl_err= SSL_get_error(ssl, res);
if (ssl_err == SSL_ERROR_WANT_READ)
Expand Down

0 comments on commit 4c1c7f3

Please sign in to comment.