wez             Fri Aug  6 10:18:50 2004 EDT

  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/standard       streamsfuncs.c 
  Log:
  MFH: avoid possible segfault with stream_socket_client and bogus flags.
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.35.2.2&r2=1.35.2.3&ty=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.35.2.2 
php-src/ext/standard/streamsfuncs.c:1.35.2.3
--- php-src/ext/standard/streamsfuncs.c:1.35.2.2        Wed Jul 28 19:34:30 2004
+++ php-src/ext/standard/streamsfuncs.c Fri Aug  6 10:18:49 2004
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.c,v 1.35.2.2 2004/07/28 23:34:30 iliaa Exp $ */
+/* $Id: streamsfuncs.c,v 1.35.2.3 2004/08/06 14:18:49 wez Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -542,7 +542,7 @@
                 * when casting.  It is only used here so that the buffered data 
warning
                 * is not displayed.
                 * */
-               if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | 
PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1)) {
+               if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | 
PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) {
                        FD_SET(this_fd, fds);
                        if (this_fd > *max_fd) {
                                *max_fd = this_fd;
@@ -578,7 +578,7 @@
                 * when casting.  It is only used here so that the buffered data 
warning
                 * is not displayed.
                 */
-               if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | 
PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1)) {
+               if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | 
PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) {
                        if (FD_ISSET(this_fd, fds)) {
                                zend_hash_next_index_insert(new_hash, (void *)elem, 
sizeof(zval *), (void **)&dest_elem);
                                if (dest_elem) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to