diff options
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/re_cache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 647375bcd..0644980da 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -632,6 +632,11 @@ rspamd_re_cache_process_pcre(struct rspamd_re_runtime *rt, if (max_hits > 0 && r >= max_hits) { break; } + + if (start >= end) { + /* We found all matches, so no more hits are possible (protect from empty patterns) */ + break; + } } rt->results[id] += r; |