[master] c5e06d6c1 Polish VRY_Match()

Nils Goroll nils.goroll at uplex.de
Mon Oct 3 14:30:07 UTC 2022


commit c5e06d6c1dd18b7a37d57b375926c5c1bb602a9c
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Sep 1 13:55:12 2022 +0200

    Polish VRY_Match()
    
    Validate VRY_Validate()

diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c
index 73bb5e15c..2e461ab0e 100644
--- a/bin/varnishd/cache/cache_vary.c
+++ b/bin/varnishd/cache/cache_vary.c
@@ -343,11 +343,11 @@ VRY_Match(struct req *req, const uint8_t *vary)
 			memcpy(vsp + 2, vary + 2, vary[2] + 2);
 			if (h != NULL)
 				memcpy(vsp + 2 + vsp[2] + 2, h, lh);
-			vsp[ln] = 0xff;
-			vsp[ln + 1] = 0xff;
-			vsp[ln + 2] = 0;
-			(void)VRY_Validate(vsp);
-			req->vary_l = vsp + ln + 3;
+			vsp[ln++] = 0xff;
+			vsp[ln++] = 0xff;
+			vsp[ln++] = 0;
+			assert(VRY_Validate(vsp) == ln);
+			req->vary_l = vsp + ln;
 
 			i = vry_cmp(vary, vsp);
 			assert(i == 0 || i == 2);


More information about the varnish-commit mailing list