]> granicus.if.org Git - php/commitdiff
MFH.
authorAndrei Zmievski <andrei@php.net>
Fri, 17 Feb 2006 21:18:09 +0000 (21:18 +0000)
committerAndrei Zmievski <andrei@php.net>
Fri, 17 Feb 2006 21:18:09 +0000 (21:18 +0000)
ext/pcre/php_pcre.c

index 1ed0df8035a7f795c4154b6333ff427e07a15e2a..557898abf3473bd99ca51d11e3be83a80e7177c7 100644 (file)
@@ -1462,7 +1462,7 @@ PHP_FUNCTION(preg_quote)
        
        /* Allocate enough memory so that even if each character
           is quoted, we won't run out of room */
-       out_str = safe_emalloc(2, Z_STRLEN_PP(in_str_arg), 1);
+       out_str = safe_emalloc(4, Z_STRLEN_PP(in_str_arg), 1);
        
        /* Go through the string and quote necessary characters */
        for(p = in_str, q = out_str; p != in_str_end; p++) {
@@ -1494,6 +1494,8 @@ PHP_FUNCTION(preg_quote)
                        case '\0':
                                *q++ = '\\';
                                *q++ = '0';
+                               *q++ = '0';
+                               *q++ = '0';
                                break;
 
                        default: