Zübeyir Eser reported in github issue #3602 that passing req.body to the
default regex engine crashes when there is no body. This is because the
body returns an empty sample while the default regex engine demands at
least one byte available to write a trailing zero.
Let's make sure that regex matches don't even run when subject to empty
strings.
This can be backported to all branches.
struct pattern *pattern;
struct pattern *ret = NULL;
+ if (!smp->data.u.str.data)
+ return ret;
+
list_for_each_entry(lst, &expr->patterns, list) {
pattern = &lst->pat;
struct pattern *ret = NULL;
struct lru64 *lru = NULL;
+ if (!smp->data.u.str.data)
+ return ret;
+
if (pat_lru_tree && !LIST_ISEMPTY(&expr->patterns) && expr->ref->entry_cnt >= 5) {
unsigned long long seed = pat_lru_seed ^ (long)expr;