From: Antony Dovgal Date: Mon, 26 Mar 2007 10:25:41 +0000 (+0000) Subject: MFH: fix #40915 (addcslashes unexpected behavior with binary input) X-Git-Tag: php-5.2.2RC1~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7053b8907247cd3df4a96409a8a811c2fb4015f5;p=php MFH: fix #40915 (addcslashes unexpected behavior with binary input) --- diff --git a/NEWS b/NEWS index a0097509d0..73ce3a6989 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ PHP NEWS - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry) - Fixed a thread safety issue in gd gif read code (Nuno, Roman Nemecek) - Fixed CVE-2007-1001, GD wbmp used with invalid image size (Pierre) +- Fixed bug #40915 (addcslashes unexpected behavior with binary input). (Tony) - Fixed bug #40899 (memory leak when nesting list()). (Dmitry) - Fixed bug #40883 (mysql_query() is allocating memory incorrectly). (Tony) - Fixed bug #40872 (inconsistency in offsetSet, offsetExists treatment of diff --git a/ext/standard/string.c b/ext/standard/string.c index 86738ff4ac..98daf7ae9c 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2858,11 +2858,8 @@ PHP_FUNCTION(addcslashes) RETURN_STRINGL(Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); } - RETURN_STRING(php_addcslashes(Z_STRVAL_PP(str), - Z_STRLEN_PP(str), - &Z_STRLEN_P(return_value), 0, - Z_STRVAL_PP(what), - Z_STRLEN_PP(what) TSRMLS_CC), 0); + Z_STRVAL_P(return_value) = php_addcslashes(Z_STRVAL_PP(str), Z_STRLEN_PP(str), &Z_STRLEN_P(return_value), 0, Z_STRVAL_PP(what), Z_STRLEN_PP(what) TSRMLS_CC); + RETURN_STRINGL(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), 0); } /* }}} */ diff --git a/ext/standard/tests/strings/bug40915.phpt b/ext/standard/tests/strings/bug40915.phpt new file mode 100644 index 0000000000..9b26896e71 Binary files /dev/null and b/ext/standard/tests/strings/bug40915.phpt differ