[master] f6b4f8065 ban_evaluate(): Do not call VRE_match on a NULL subject

Nils Goroll nils.goroll at uplex.de
Tue Sep 28 14:48:07 UTC 2021


commit f6b4f806564e65b531b34cba8ae09e3ac65b0654
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Sep 28 16:44:24 2021 +0200

    ban_evaluate(): Do not call VRE_match on a NULL subject
    
    Fixes #3706

diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index bd02f3001..ab523cd6e 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -568,15 +568,19 @@ ban_evaluate(struct worker *wrk, const uint8_t *bsarg, struct objcore *oc,
 			}
 			break;
 		case BANS_OPER_MATCH:
+			if (arg1 == NULL)
+				return (0);
 			rv = VRE_match(bt.arg2_spec, arg1, 0, 0, NULL);
 			xxxassert(rv >= -1);
-			if (arg1 == NULL || rv < 0)
+			if (rv < 0)
 				return (0);
 			break;
 		case BANS_OPER_NMATCH:
+			if (arg1 == NULL)
+				return (0);
 			rv = VRE_match(bt.arg2_spec, arg1, 0, 0, NULL);
 			xxxassert(rv >= -1);
-			if (arg1 == NULL || rv >= 0)
+			if (rv >= 0)
 				return (0);
 			break;
 		case BANS_OPER_GT:


More information about the varnish-commit mailing list