From: tfheen Date: Sun, 7 Sep 2008 07:47:26 +0000 (+0000) Subject: Don't segfault on purge.hash() with NULL string. Fixes #307. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a603f03efbf05bb5e0d6b0044a0efba4729b0451;p=varnish Don't segfault on purge.hash() with NULL string. Fixes #307. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3163 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvcl/vcc_action.c b/varnish-cache/lib/libvcl/vcc_action.c index 00d29e27..ac7bf711 100644 --- a/varnish-cache/lib/libvcl/vcc_action.c +++ b/varnish-cache/lib/libvcl/vcc_action.c @@ -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"); }