]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Avoid out of boundary reads
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 14 Oct 2017 12:22:52 +0000 (13:22 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 14 Oct 2017 12:22:52 +0000 (13:22 +0100)
src/libmime/message.c

index ce53c15f9b6c0ff019f09a977c2986a9641498fd..4381302fa72bb3bbff5e174f002e5e3493dc1433 100644 (file)
@@ -454,7 +454,7 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
                                if (G_UNLIKELY (*p) == ' ') {
                                        part->spaces ++;
 
-                                       if (*(p - 1) == ' ') {
+                                       if (p > begin && *(p - 1) == ' ') {
                                                part->double_spaces ++;
                                        }
                                }
@@ -524,7 +524,7 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
                                else {
                                        part->non_spaces ++;
 
-                                       if (G_UNLIKELY (*p & 0x80)) {
+                                       if (G_UNLIKELY (*c & 0x80)) {
                                                part->non_ascii_chars ++;
                                        }
                                        else {