commit 1e7b5d6: [Minor] Check boundary before calling for U8_NEXT

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Nov 5 17:49:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-11-05 17:45:16 +0000
URL: https://github.com/rspamd/rspamd/commit/1e7b5d6fed44f53ea87090b5480112230ec8e044 (HEAD -> master)

[Minor] Check boundary before calling for U8_NEXT

---
 src/libmime/message.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libmime/message.c b/src/libmime/message.c
index 648fa82c5..f3aba6001 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -242,7 +242,7 @@ rspamd_strip_newlines_parse (struct rspamd_task *task,
 			U8_NEXT (begin, off, pe - begin, uc);
 
 			if (uc != -1) {
-				while (p < pe) {
+				while (p < pe && off < (pe - begin)) {
 					if (IS_ZERO_WIDTH_SPACE (uc)) {
 						/* Invisible space ! */
 						task->flags |= RSPAMD_TASK_FLAG_BAD_UNICODE;


More information about the Commits mailing list