Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 79a034b4aed29e965f45a13409268290c9910043 Mon Sep 17 00:00:00 2001 | ||
From: martijn <martijn@openbsd.org> | ||
Date: Wed, 23 Dec 2020 08:12:14 +0000 | ||
Subject: [PATCH] Use regfree after we're done with preg. | ||
|
||
From gilles@ | ||
--- | ||
usr.sbin/smtpd/table.c | 9 +++++++-- | ||
1 file changed, 7 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/smtpd/table.c b/smtpd/table.c | ||
index b79451caadd..1d82d88b81a 100644 | ||
--- a/smtpd/table.c | ||
+++ b/smtpd/table.c | ||
@@ -1,4 +1,4 @@ | ||
-/* $OpenBSD: table.c,v 1.48 2019/01/10 07:40:52 eric Exp $ */ | ||
+/* $OpenBSD: table.c,v 1.49 2020/12/23 08:12:14 martijn Exp $ */ | ||
|
||
/* | ||
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org> | ||
@@ -464,6 +464,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; | ||
@@ -473,7 +474,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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 6c3220444ed06b5796dedfd53a0f4becd903c0d1 Mon Sep 17 00:00:00 2001 | ||
From: millert <millert@openbsd.org> | ||
Date: Wed, 23 Dec 2020 20:17:49 +0000 | ||
Subject: [PATCH] smtpd's filter state machine can prematurely release | ||
resources leading to a crash. From gilles@ | ||
|
||
--- | ||
usr.sbin/smtpd/lka_filter.c | 7 +------ | ||
1 file changed, 1 insertion(+), 6 deletions(-) | ||
|
||
diff --git a/smtpd/lka_filter.c b/smtpd/lka_filter.c | ||
index 21b10ce1033..d1194254d8d 100644 | ||
--- a/smtpd/lka_filter.c | ||
+++ b/smtpd/lka_filter.c | ||
@@ -600,11 +600,6 @@ filter_session_io(struct io *io, int evt, void *arg) | ||
filter_data(fs->id, line); | ||
|
||
goto nextline; | ||
- | ||
- case IO_DISCONNECTED: | ||
- io_free(fs->io); | ||
- fs->io = NULL; | ||
- break; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters