]> granicus.if.org Git - php/commitdiff
Fix an ereg_replace() crash bug
authorZeev Suraski <zeev@php.net>
Mon, 7 Jun 1999 15:01:25 +0000 (15:01 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 7 Jun 1999 15:01:25 +0000 (15:01 +0000)
ext/ereg/ereg.c
ext/standard/reg.c

index c839e1ab12167694e17d70137ad456f313d88e79..137393378049d8c78f50307a54995132e5bc321a 100644 (file)
@@ -319,7 +319,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
 
        string_len = strlen(string);
        if (!string_len)
-               return (char *)string;
+               return estrndup("", 0);
 
        if (icase)
                copts = REG_ICASE;
index c839e1ab12167694e17d70137ad456f313d88e79..137393378049d8c78f50307a54995132e5bc321a 100644 (file)
@@ -319,7 +319,7 @@ char *_php3_regreplace(const char *pattern, const char *replace, const char *str
 
        string_len = strlen(string);
        if (!string_len)
-               return (char *)string;
+               return estrndup("", 0);
 
        if (icase)
                copts = REG_ICASE;