aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-21 23:33:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-21 23:33:00 +0100
commit4e1d3a991c9fa13bbfba7cb6a841c4d59fe3b0af (patch)
tree041b33221e33bec319fe055696830488929db512
parentd36a02d833ebff356dfeec3dc7e97a6dc1361fb0 (diff)
downloadrspamd-4e1d3a991c9fa13bbfba7cb6a841c4d59fe3b0af.tar.gz
rspamd-4e1d3a991c9fa13bbfba7cb6a841c4d59fe3b0af.zip
[Minor] Fix boundary check
-rw-r--r--src/libutil/str_util.c4
1 files changed, 2 insertions, 2 deletions
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;
}