diff options
author | Gilles CHEHADE <gilles@poolp.org> | 2020-12-23 14:58:20 +0100 |
---|---|---|
committer | Gilles CHEHADE <gilles@poolp.org> | 2020-12-23 14:58:49 +0100 |
commit | 6d1e617b1e3fd98ebf90dbd8c5cc83559b693ccf (patch) | |
tree | 39b3ba894ad0d81675d5cd5efa4d1fed4979ee2b | |
parent | do not kill io channel on IO_DISCONNECTED (diff) | |
download | OpenSMTPD-6.8.0p1.tar.xz OpenSMTPD-6.8.0p1.zip |
plug a leak in regex table lookupsv6.8.0p1
-rw-r--r-- | usr.sbin/smtpd/table.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index 469eeee1..6d3292ce 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -470,6 +470,7 @@ table_regex_match(const char *string, const char *pattern) { regex_t preg; int cflags = REG_EXTENDED|REG_NOSUB; + int ret; if (strncmp(pattern, "(?i)", 4) == 0) { cflags |= REG_ICASE; @@ -479,7 +480,11 @@ table_regex_match(const char *string, const char *pattern) if (regcomp(&preg, pattern, cflags) != 0) return (0); - if (regexec(&preg, string, 0, NULL, 0) != 0) + ret = regexec(&preg, string, 0, NULL, 0); + + regfree(&preg); + + if (ret != 0) return (0); return (1); |