r3163 - trunk/varnish-cache/lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Sun Sep 7 09:47:26 CEST 2008


Author: tfheen
Date: 2008-09-07 09:47:26 +0200 (Sun, 07 Sep 2008)
New Revision: 3163

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_action.c
Log:
Don't segfault on purge.hash() with NULL string.  Fixes #307.


Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c	2008-09-03 13:26:36 UTC (rev 3162)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c	2008-09-07 07:47:26 UTC (rev 3163)
@@ -336,22 +336,26 @@
 static void
 parse_purge_url(struct tokenlist *tl)
 {
+	struct var *vp;
 
 	vcc_NextToken(tl);
 	
-	Fb(tl, 1, "VRT_purge(");
-	
 	Expect(tl, '(');
 	vcc_NextToken(tl);
 	
-	if (!vcc_StringVal(tl)) {
+	vp = vcc_FindVar(tl, tl->t, vcc_vars);
+	ERRCHK(tl);
+	assert(vp != NULL);
+	if (vp->fmt != STRING) {
 		vcc_ExpectedStringval(tl);
 		return;
 	}
 	
+	Fb(tl, 1, "if (%s) VRT_purge(%s, 0);\n", vp->rname, vp->rname);
+	vcc_NextToken(tl);
+
 	Expect(tl, ')');
 	vcc_NextToken(tl);
-	Fb(tl, 0, ", 0);\n");
 }
 
 




More information about the varnish-commit mailing list