From 5d2a065cb612192779b30a030a9e4b5a6e87eb93 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 14 Oct 2017 13:22:52 +0100 Subject: [Minor] Avoid out of boundary reads --- src/libmime/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libmime/message.c b/src/libmime/message.c index ce53c15f9..4381302fa 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -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 { -- cgit v1.2.3