commit bdcbf7a: [Minor] Fix OOB access

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Sep 27 09:49:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-27 10:47:34 +0100
URL: https://github.com/rspamd/rspamd/commit/bdcbf7aa2db8dd9acfd8fd1c08b7909de5106760 (HEAD -> master)

[Minor] Fix OOB access

---
 src/libmime/mime_parser.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index 1153a54c7..1c132335c 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -927,17 +927,19 @@ rspamd_mime_preprocess_cb (struct rspamd_multipattern *mp,
 				bend ++;
 			}
 
-			if (*bend == '\r') {
-				bend ++;
+			if (bend < end) {
+				if (*bend == '\r') {
+					bend++;
 
-				/* \r\n */
-				if (*bend == '\n') {
-					bend ++;
+					/* \r\n */
+					if (*bend == '\n') {
+						bend++;
+					}
+				}
+				else {
+					/* \n */
+					bend++;
 				}
-			}
-			else {
-				/* \n */
-				bend ++;
 			}
 
 			b.boundary = p - st->start - 2;


More information about the Commits mailing list