summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-03-26 10:25:41 +0000
committerAntony Dovgal <tony2001@php.net>2007-03-26 10:25:41 +0000
commit7053b8907247cd3df4a96409a8a811c2fb4015f5 (patch)
treefe9be67fe1706e8a7d6d4a5a52009518656d0c26
parent4e085083cd40f482480b7fb469af60ab842f5111 (diff)
downloadphp-git-7053b8907247cd3df4a96409a8a811c2fb4015f5.tar.gz
MFH: fix #40915 (addcslashes unexpected behavior with binary input)
-rw-r--r--NEWS1
-rw-r--r--ext/standard/string.c7
-rw-r--r--ext/standard/tests/strings/bug40915.phptbin0 -> 347 bytes
3 files changed, 3 insertions, 5 deletions
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
--- /dev/null
+++ b/ext/standard/tests/strings/bug40915.phpt
Binary files differ