]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix buffer overrun when HTML exceptions are used.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Aug 2014 11:51:48 +0000 (12:51 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Aug 2014 11:52:29 +0000 (12:52 +0100)
src/tokenizers/tokenizers.c

index 43dcfac82abbd5077609e64489e31f96e83d9acd..040c1dd7965f0c7b7e288c93eb99701d5de2b6c5 100644 (file)
@@ -137,11 +137,12 @@ get_next_word (f_str_t * buf, f_str_t * token, GList **exceptions)
 
        token->len = 0;
 
-       remain = buf->len - (token->begin - buf->begin);
-       if (remain == 0) {
+       pos = token->begin - buf->begin;
+       if (pos >= buf->len) {
                return NULL;
        }
-       pos = token->begin - buf->begin;
+
+       remain = buf->len - pos;
        p = token->begin;
        /* Skip non delimiters symbols */
        do {