]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not try to dereference last character
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Oct 2017 18:56:28 +0000 (18:56 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 31 Oct 2017 19:12:20 +0000 (19:12 +0000)
MFH: rspamd-1.6

src/libstat/tokenizers/tokenizers.c

index f75310fe3ba907ba1dd799c870ae7f66589ae924..aec801b056fb1c3975bc6b213bce3a7183ff9e41 100644 (file)
@@ -198,7 +198,7 @@ rspamd_tokenizer_get_word (rspamd_stat_token_t * buf,
        p = s;
        token->begin = s;
 
-       for (i = 0; i <= remain; ) {
+       for (i = 0; i < remain; ) {
                p = &s[i];
                U8_NEXT (s, i, remain, uc); /* This also advances i */
 
@@ -254,6 +254,13 @@ rspamd_tokenizer_get_word (rspamd_stat_token_t * buf,
                }
        }
 
+       /* Last character */
+       if (state == feed_token) {
+               goto set_token;
+       }
+
+       return FALSE;
+
 set_token:
        if (rl) {
                *rl = processed;