]> granicus.if.org Git - php/commitdiff
MFH: fix #40915 (addcslashes unexpected behavior with binary input)
authorAntony Dovgal <tony2001@php.net>
Mon, 26 Mar 2007 10:25:41 +0000 (10:25 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 26 Mar 2007 10:25:41 +0000 (10:25 +0000)
NEWS
ext/standard/string.c
ext/standard/tests/strings/bug40915.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index a0097509d0a60ab47bdd27a3be4a8b573233fde7..73ce3a6989da141d116f22430a40c2410df5dc89 100644 (file)
--- 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 
index 86738ff4ac61f62983441c443615e1330fb4eead..98daf7ae9cb79bd190fe189cf8bcf314c48fc1e3 100644 (file)
@@ -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 (file)
index 0000000..9b26896
Binary files /dev/null and b/ext/standard/tests/strings/bug40915.phpt differ