Skip to content

Commit 31ebb42

Browse files
committed
Fix missing checks against php_set_blocking() in xp_ssl.c
1 parent b2d78ae commit 31ebb42

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ext/openssl/xp_ssl.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,8 +2092,9 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
20922092
if (php_openssl_compare_timeval(elapsed_time, *timeout) > 0 ) {
20932093
/* If the socket was originally blocking, set it back. */
20942094
if (began_blocked) {
2095-
php_set_sock_blocking(sslsock->s.socket, 1);
2096-
sslsock->s.is_blocked = 1;
2095+
if (php_set_sock_blocking(sslsock->s.socket, 1) == SUCCESS) {
2096+
sslsock->s.is_blocked = 1;
2097+
}
20972098
}
20982099
sslsock->s.timeout_event = 1;
20992100
return -1;
@@ -2520,8 +2521,9 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
25202521
if (php_openssl_compare_timeval(elapsed_time, *timeout) > 0 ) {
25212522
/* If the socket was originally blocking, set it back. */
25222523
if (began_blocked) {
2523-
php_set_sock_blocking(sslsock->s.socket, 1);
2524-
sslsock->s.is_blocked = 1;
2524+
if (php_set_sock_blocking(sslsock->s.socket, 1) == SUCCESS) {
2525+
sslsock->s.is_blocked = 1;
2526+
}
25252527
}
25262528
sslsock->s.timeout_event = 1;
25272529
return PHP_STREAM_OPTION_RETURN_ERR;
@@ -2572,8 +2574,9 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
25722574

25732575
if (began_blocked && !sslsock->s.is_blocked) {
25742576
// Set it back to blocking
2575-
php_set_sock_blocking(sslsock->s.socket, 1);
2576-
sslsock->s.is_blocked = 1;
2577+
if (php_set_sock_blocking(sslsock->s.socket, 1) == SUCCESS) {
2578+
sslsock->s.is_blocked = 1;
2579+
}
25772580
}
25782581
} else {
25792582
#ifdef PHP_WIN32

0 commit comments

Comments
 (0)