[master] 40555a0 fix VBF_Get_Filter_List for the no filter case

Nils Goroll nils.goroll at uplex.de
Fri Apr 20 11:55:15 UTC 2018


commit 40555a04d44e3750634619f0479d344c1f2d1346
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Apr 20 13:46:03 2018 +0200

    fix VBF_Get_Filter_List for the no filter case
    
    If vbf_default_filter_list() returned without anything written to
    the vsb (for no body or length 0), we would return as the filter
    list whatever existed at ws->f + 1 prior to calling VBF_Get_Filter_List
    (for example the string logged with std.log()).
    
    Consequently, backend requests would fail with
    
    	FetchError     Filter '...' not found

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 487807c..f0b5fcf 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -580,8 +580,12 @@ VBF_Get_Filter_List(struct busyobj *bo)
 		WS_MarkOverflow(bo->ws);
 		return (NULL);
 	}
-	WS_Release(bo->ws, VSB_len(vsb) + 1);
-	return (VSB_data(vsb) + 1);
+	if (VSB_len(vsb)) {
+		WS_Release(bo->ws, VSB_len(vsb) + 1);
+		return (VSB_data(vsb) + 1);
+	}
+	WS_Release(bo->ws, 0);
+	return ("");
 }
 
 static enum fetch_step


More information about the varnish-commit mailing list