From: Zeev Suraski Date: Mon, 7 Jun 1999 15:01:25 +0000 (+0000) Subject: Fix an ereg_replace() crash bug X-Git-Tag: BEFORE_REMOVING_GC_STEP1~179 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b886985d63c001bd2592d22c0c0b143cb95ebb7e;p=php Fix an ereg_replace() crash bug --- diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index c839e1ab12..1373933780 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -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; diff --git a/ext/standard/reg.c b/ext/standard/reg.c index c839e1ab12..1373933780 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -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;