From: Alan T. DeKok Date: Sat, 3 Jan 2015 01:22:35 +0000 (-0500) Subject: nmatch may be NULL, too. Closes #868 X-Git-Tag: release_3_0_7~366 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fada4f42632281e5180e4a7b488a0d4fb010c9c;p=thirdparty%2Ffreeradius-server.git nmatch may be NULL, too. Closes #868 --- diff --git a/src/lib/regex.c b/src/lib/regex.c index a11c49d37b0..232af70098b 100644 --- a/src/lib/regex.c +++ b/src/lib/regex.c @@ -152,10 +152,17 @@ int regex_exec(regex_t *preg, char const *subject, size_t len, regmatch_t pmatch if (!pmatch || !nmatch) { pmatch = NULL; if (nmatch) *nmatch = 0; + nmatch = NULL; matches = 0; eflags |= PCRE_NO_AUTO_CAPTURE; - } else { + + } else if (nmatch) { matches = *nmatch; + + } else { + eflags |= PCRE_NO_AUTO_CAPTURE; + pmatch = NULL; + matches = 0; } ret = pcre_exec(preg->compiled, preg->extra, subject, len, 0, eflags, (int *)pmatch, matches * 3);