]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix OOB access
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 09:47:34 +0000 (10:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 09:47:34 +0000 (10:47 +0100)
src/libmime/mime_parser.c

index 1153a54c7c3b5f3eebf9b5ef4dcec6f6b336b6d4..1c132335cffdd780b9b7dc52679261c75aa88906 100644 (file)
@@ -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;