From b886985d63c001bd2592d22c0c0b143cb95ebb7e Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Mon, 7 Jun 1999 15:01:25 +0000 Subject: [PATCH] Fix an ereg_replace() crash bug --- ext/ereg/ereg.c | 2 +- ext/standard/reg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; -- 2.50.1