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

Nils Goroll nils.goroll at uplex.de
Tue Nov 23 12:31:07 UTC 2021


commit 46bbfe2584380dec4c9036cfdc4a28d6c3d1ab9c
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