From 2f536c9d4fa1216c9be8b25443a24e4b8f721925 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 7 Apr 2017 13:17:42 +0100 Subject: [PATCH] [Minor] Use safe version of utf8 macro --- src/plugins/chartable.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/chartable.c b/src/plugins/chartable.c index 5ff7fc380..aed8ee804 100644 --- a/src/plugins/chartable.c +++ b/src/plugins/chartable.c @@ -191,7 +191,11 @@ rspamd_chartable_process_word_utf (struct rspamd_task *task, /* We assume that w is normalized */ while (p + i < end) { - U8_NEXT_UNSAFE (p, i, uc); + U8_NEXT (p, i, w->len, uc); + + if (((gint32)uc) < 0) { + break; + } if (u_isalpha (uc)) { sc = ublock_getCode (uc); -- 2.39.5