diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-12 12:51:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-08-12 12:52:29 +0100 |
commit | 65abf31f226588d7eb3315d8b07449b4cb7f22bf (patch) | |
tree | 0f96670b9054512ebfdb045301f4998b321d81f5 | |
parent | 844bb8cb85badba373d6ee48790652738834f53c (diff) | |
download | rspamd-65abf31f226588d7eb3315d8b07449b4cb7f22bf.tar.gz rspamd-65abf31f226588d7eb3315d8b07449b4cb7f22bf.zip |
Fix buffer overrun when HTML exceptions are used.
-rw-r--r-- | src/tokenizers/tokenizers.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tokenizers/tokenizers.c b/src/tokenizers/tokenizers.c index 43dcfac82..040c1dd79 100644 --- a/src/tokenizers/tokenizers.c +++ b/src/tokenizers/tokenizers.c @@ -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 { |