]> granicus.if.org Git - php/commitdiff
MFH: Fixed a bug in addslashes() handling of the '\0' character.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 17 Oct 2004 18:41:30 +0000 (18:41 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 17 Oct 2004 18:41:30 +0000 (18:41 +0000)
NEWS
ext/standard/string.c

diff --git a/NEWS b/NEWS
index 1ea43b35c60464c9d956df6f72141bfef9805b71..87cb04a5324f8fee7f599b50bc4faab4fc096aba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, Version 4.3.10
+- Fixed a bug in addslashes() handling of the '\0' character. (Ilia)
 - Backported Marcus' foreach() speedup patch from PHP 5.x. (Derick)
 - Fixed potential problems with unserializing invalid serialize data. (Marcus)
 - Fixed bug #30282 (segfault when using unknown/unsupported
index 2a243214b00476e5e42bdba7b112f70d6283812c..9fbf0fecd1ed10fd70f60c99fb0d35da55e24cef 100644 (file)
@@ -2443,7 +2443,13 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
        p = str;
        if (!type) {
                while (p < e) {
-                       if (php_esc_list[(int)(unsigned char)*p]) {
+                       int c = php_esc_list[(int)(unsigned char)*p];
+                       if (c == 2) {
+                               *ps++ = '\\';
+                               *ps++ = '0';
+                               p++;
+                               continue;
+                       } else if (c) {
                                *ps++ = '\\';
                        }
                        *ps++ = *p++;