aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}