cvs: php-src(PHP_4_3) / NEWS /ext/standard basic_functions.c

From: Date: Fri, 19 Dec 2003 13:33:58 +0000
Subject: cvs: php-src(PHP_4_3) / NEWS /ext/standard basic_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-25320@lists.php.net to get a copy of this message
iliaa Fri Dec 19 08:33:58 2003 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/standard basic_functions.c Log: MFH: Fixed bug #26667 (Added safety checks to ip2long()). Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.509 php-src/NEWS:1.1247.2.510 --- php-src/NEWS:1.1247.2.509 Thu Dec 18 04:52:51 2003 +++ php-src/NEWS Fri Dec 19 08:33:56 2003 @@ -9,6 +9,7 @@ - Added a warning when creating temp stream fails with ftp_(n)list(). (Sara) - Fixed header handler in NSAPI SAPI module (header->replace was ignored, send_default_content_type now sends value from php.ini). (Uwe Schindler) +- Fixed bug #26667 (Added safety checks to ip2long()). (Ilia) - Fixed bug #26639 (mb_convert_variables() clutters variables beyond the references). (Moriyoshi) - Fixed bug #26635 (fixed look up for fonts in the current directory w/ZTS). Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.543.2.27 php-src/ext/standard/basic_functions.c:1.543.2.28 --- php-src/ext/standard/basic_functions.c:1.543.2.27 Sat Nov 29 15:48:49 2003 +++ php-src/ext/standard/basic_functions.c Fri Dec 19 08:33:57 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.543.2.27 2003/11/29 20:48:49 wez Exp $ */ +/* $Id: basic_functions.c,v 1.543.2.28 2003/12/19 13:33:57 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1229,6 +1229,7 @@ PHP_FUNCTION(ip2long) { zval **str; + unsigned long int ip; if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -1236,7 +1237,11 @@ convert_to_string_ex(str); - RETURN_LONG(ntohl(inet_addr(Z_STRVAL_PP(str)))); + if (Z_STRVAL_PP(str) == "" || (ip = inet_addr(Z_STRVAL_PP(str))) == INADDR_NONE) { + RETURN_LONG(-1); + } + + RETURN_LONG(ntohl(ip)); } /* }}} */

« previous php.cvs (#25320) next »