com php-src: validate sockets portable way: ext/mysqlnd/mysqlnd.c
| From: | Anatol Belski | Date: | Fri, 14 Nov 2014 16:39:38 +0000 |
| Subject: | com php-src: validate sockets portable way: ext/mysqlnd/mysqlnd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83094@lists.php.net to get a copy of this message | ||
Commit: 8434a7f2abb6ee5be0a4b38c1a7add6cdc21a426
Author: Anatol Belski <ab@php.net> Fri, 14 Nov 2014 10:17:43 +0100
Parents: e1d0ca7cae51b3f3c5baef83fc81f397e9e64ded
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8434a7f2abb6ee5be0a4b38c1a7add6cdc21a426
Log:
validate sockets portable way
Changed paths:
M ext/mysqlnd/mysqlnd.c
Diff:
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 41f34e3..08a10db 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -1306,7 +1306,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds,
p
stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC);
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT |
PHP_STREAM_CAST_INTERNAL,
- (void*)&this_fd, 1) && this_fd >= 0) {
+ (void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
PHP_SAFE_FD_SET(this_fd, fds);
@@ -1336,7 +1336,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set *
fds
stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC);
DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream);
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT |
PHP_STREAM_CAST_INTERNAL,
- (void*)&this_fd, 1) && this_fd >= 0) {
+ (void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
if (disproportion) {
*bckwd = *fwd;