From: Vsevolod Stakhov Date: Thu, 21 Jun 2018 22:33:00 +0000 (+0100) Subject: [Minor] Fix boundary check X-Git-Tag: 1.7.7~64 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4e1d3a991c9fa13bbfba7cb6a841c4d59fe3b0af;p=rspamd.git [Minor] Fix boundary check --- diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index cfacf514f..d17485ebf 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -1747,7 +1747,7 @@ rspamd_memcspn (const gchar *s, const gchar *e, gsize len) const gchar *p = s, *end = s + len; if (!e[1]) { - for (; *p != *e; p++); + for (; p < end && *p != *e; p++); return p - s; } @@ -1766,7 +1766,7 @@ rspamd_memspn (const gchar *s, const gchar *e, gsize len) const gchar *p = s, *end = s + len; if (!e[1]) { - for (; *p == *e; p++); + for (; p < end && *p == *e; p++); return p - s; }