diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/pcre.c | 4 | ||||
-rw-r--r-- | Src/Modules/regex.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index f8b79adea..e1a897944 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -194,8 +194,8 @@ zpcre_get_substrings(char *arg, int *ovec, int ret, char *matchvar, char **mbegin, **mend, **bptr, **eptr; int i, *ipair; - bptr = mbegin = zalloc(nelem+1); - eptr = mend = zalloc(nelem+1); + bptr = mbegin = zalloc(sizeof(char*)*(nelem+1)); + eptr = mend = zalloc(sizeof(char*)*(nelem+1)); for (ipair = ovec + 2, i = 0; i < nelem; diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c index 25dbddf07..08e815003 100644 --- a/Src/Modules/regex.c +++ b/Src/Modules/regex.c @@ -135,11 +135,11 @@ zcond_regex_match(char **a, int id) setiparam("MEND", offs + !isset(KSHARRAYS) - 1); if (nelem) { char **mbegin, **mend, **bptr, **eptr; - bptr = mbegin = (char **)zalloc(nelem+1); - eptr = mend = (char **)zalloc(nelem+1); + bptr = mbegin = (char **)zalloc(sizeof(char *)*(nelem+1)); + eptr = mend = (char **)zalloc(sizeof(char *)*(nelem+1)); - for (m = matches + start, n = start; - n <= (int)re.re_nsub; + for (m = matches + start, n = 0; + n < nelem; ++n, ++m, ++bptr, ++eptr) { char buf[DIGBUFSIZE]; |