]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix out-of-boundary access
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Mar 2018 12:25:21 +0000 (13:25 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 27 Mar 2018 12:25:21 +0000 (13:25 +0100)
src/libmime/message.c
src/libstat/tokenizers/tokenizers.c

index 756cd9b478aa6ebcd82a918e4d4955be07aa5145..37882aaf601853978a79f8d33be942003d765e60 100644 (file)
@@ -404,7 +404,7 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
                                                part->spaces ++;
                                        }
 
-                                       if (*p == '\r' || *p == '\n') {
+                                       if (p < pe && (*p == '\r' || *p == '\n')) {
                                                part->empty_lines ++;
                                        }
                                }
@@ -419,6 +419,10 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
 
        /* Leftover */
        if (p > c) {
+               if (p > pe) {
+                       p = pe;
+               }
+
                switch (state) {
                case normal_char:
                        g_byte_array_append (part->stripped_content,
index d253c1aa6879cddc884bb2d580c51599c0a912cd..36861b1965cb13104186dc5c2495d989acde6554 100644 (file)
@@ -338,7 +338,7 @@ rspamd_tokenize_text (gchar *text, gsize len, gboolean is_utf,
 {
        rspamd_stat_token_t token, buf;
        const gchar *pos = NULL;
-       gsize l;
+       gsize l = 0;
        GArray *res;
        GList *cur = exceptions;
        token_get_function func;