wez Fri Aug 6 10:08:18 2004 EDT
Modified files:
/php-src/ext/standard streamsfuncs.c
Log:
Avoid possible segfault when using stream_socket_client with bogus flags.
http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.39&r2=1.40&ty=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.39
php-src/ext/standard/streamsfuncs.c:1.40
--- php-src/ext/standard/streamsfuncs.c:1.39 Sat Jul 31 13:28:27 2004
+++ php-src/ext/standard/streamsfuncs.c Fri Aug 6 10:08:17 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.39 2004/07/31 17:28:27 wez Exp $ */
+/* $Id: streamsfuncs.c,v 1.40 2004/08/06 14:08:17 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