cvs: php4 /ext/sockets sockets.c
| From: | Chris Vandomelen | Date: | Sun, 20 Aug 2000 19:48:42 +0000 |
| Subject: | cvs: php4 /ext/sockets sockets.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1271@lists.php.net to get a copy of this message | ||
chrisv Sun Aug 20 12:48:42 2000 EDT
Modified files:
/php4/ext/sockets sockets.c
Log:
Added another bug fix to detect for negative values being passed into the
fd_*() functions, as passing negative values would cause PHP to segfault.
Index: php4/ext/sockets/sockets.c
diff -u php4/ext/sockets/sockets.c:1.5 php4/ext/sockets/sockets.c:1.6
--- php4/ext/sockets/sockets.c:1.5 Sun Aug 20 03:31:27 2000
+++ php4/ext/sockets/sockets.c Sun Aug 20 12:48:42 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.5 2000/08/20 10:31:27 sterling Exp $ */
+/* $Id: sockets.c,v 1.6 2000/08/20 19:48:42 chrisv Exp $ */
#include "php.h"
@@ -271,6 +271,11 @@
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set",
SOCKETSG(le_destroy));
+ if (Z_LVAL_PP(fd) < 0) {
+ php_error(E_WARNING, "Can't set negative fd falues in a set");
+ RETURN_FALSE;
+ }
+
FD_SET(Z_LVAL_PP(fd), the_set);
RETURN_TRUE;
@@ -293,6 +298,11 @@
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set",
SOCKETSG(le_destroy));
+ if (Z_LVAL_PP(fd) < 0) {
+ php_error(E_WARNING, "Can't clear negative fd values in a set");
+ RETURN_FALSE;
+ }
+
FD_CLR(Z_LVAL_PP(fd), the_set);
RETURN_TRUE;
@@ -314,6 +324,11 @@
convert_to_long_ex(fd);
ZEND_FETCH_RESOURCE(the_set, fd_set *, set, -1, "File descriptor set",
SOCKETSG(le_destroy));
+
+ if (Z_LVAL_PP(fd) < 0) {
+ php_error(E_WARNING, "Can't check for negative fd values in a set");
+ RETURN_FALSE;
+ }
if (FD_ISSET(Z_LVAL_PP(fd), the_set)) {
RETURN_TRUE;