- 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).
PHP_FUNCTION(ip2long)
{
zval **str;
+ unsigned long int ip;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
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));
}
/* }}} */