]> err.no Git - varnish/commitdiff
Don't segfault on purge.hash() with NULL string. Fixes #307.
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 7 Sep 2008 07:47:26 +0000 (07:47 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 7 Sep 2008 07:47:26 +0000 (07:47 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3163 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvcl/vcc_action.c

index 00d29e2711a92b8a7ed2dc4f47f87281dcea8e0e..ac7bf711d173883b3cd21f35a680903c549fe1ad 100644 (file)
@@ -336,22 +336,26 @@ parse_unset(struct tokenlist *tl)
 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");
 }