bogofilter/0002-Fix-out-of-bounds-read-in-spanword-126.patch
2019-02-13 09:13:03 +01:00

31 lines
828 B
Diff

From 63317a12e89040badf0cc82d82a8b6f64703cd6d Mon Sep 17 00:00:00 2001
From: Georg Sauthoff <mail@georg.so>
Date: Mon, 11 Feb 2019 10:02:21 +0100
Subject: [PATCH 02/11] Fix out-of-bounds read in spanword (#126)
cf. https://sourceforge.net/p/bogofilter/bugs/126/
---
src/wordlists.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/wordlists.c b/src/wordlists.c
index 735af34..a5d529e 100644
--- a/src/wordlists.c
+++ b/src/wordlists.c
@@ -307,8 +307,10 @@ static char *spanword(char *p)
{
const char *delim = ", \t";
p += strcspn(p, delim); /* skip to end of word */
- *p++ = '\0';
- p += strspn(p, " \t"); /* skip trailing whitespace */
+ if (*p) {
+ *p++ = '\0';
+ p += strspn(p, " \t"); /* skip trailing whitespace */
+ }
return p;
}
--
2.20.1