--- Src/Modules/regex.c.old Sat Apr 28 17:40:12 2007 +++ Src/Modules/regex.c Sat Apr 28 17:43:27 2007 @@ -75,6 +75,11 @@ zcond_regex_match(char **a, int id) /* re.re_nsub is number of parenthesized groups, we also need * 1 for the 0 offset, which is the entire matched portion */ + if (re.re_nsub < 0) { + zwarn("INTERNAL ERROR: regcomp() returned " + "negative subpattern count %d", re.re_nsub); + break; + } matchessz = (re.re_nsub + 1) * sizeof(regmatch_t); matches = zalloc(matchessz); r = regexec(&re, lhstr, re.re_nsub+1, matches, reflags); @@ -88,6 +93,7 @@ zcond_regex_match(char **a, int id) start = 1; nelem = re.re_nsub; } + arr = NULL; /* bogus gcc warning of used uninitialised */ /* entire matched portion + re_nsub substrings + NULL */ if (nelem) { arr = x = (char **) zalloc(sizeof(char *) * (nelem + 1));