From: Ilia Alshanetsky Date: Thu, 12 Oct 2006 01:05:09 +0000 (+0000) Subject: Fixed potential use of un-initialized var (detected by Coverity) X-Git-Tag: php-5.2.0RC6~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b8eb2cf88a2ce9bb27f589b290175201b30546d;p=php Fixed potential use of un-initialized var (detected by Coverity) --- diff --git a/ext/ereg/regex/regcomp.c b/ext/ereg/regex/regcomp.c index ec034d4c4c..d72cc82940 100644 --- a/ext/ereg/regex/regcomp.c +++ b/ext/ereg/regex/regcomp.c @@ -1553,6 +1553,11 @@ register struct re_guts *g; if (g->mlen == 0) /* there isn't one */ return; + if (!start) { + g->mlen = 0; + return; + } + /* turn it into a character string */ g->must = malloc((size_t)g->mlen + 1); if (g->must == NULL) { /* argh; just forget it */ diff --git a/regex/regcomp.c b/regex/regcomp.c index ec034d4c4c..d72cc82940 100644 --- a/regex/regcomp.c +++ b/regex/regcomp.c @@ -1553,6 +1553,11 @@ register struct re_guts *g; if (g->mlen == 0) /* there isn't one */ return; + if (!start) { + g->mlen = 0; + return; + } + /* turn it into a character string */ g->must = malloc((size_t)g->mlen + 1); if (g->must == NULL) { /* argh; just forget it */