From: phk Date: Tue, 27 Jan 2009 12:18:12 +0000 (+0000) Subject: proper errorchecks for regsub syntax. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a169c2a3571661e1447c64c6daa2a5afdd52dcfe;p=varnish proper errorchecks for regsub syntax. (The recent change that moved the compiler into its own subprocess eliminates risk that a compiler error causes the management process to die, you just do not get a sensible syntax error). Fixes: #417 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3546 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvcl/vcc_string.c b/varnish-cache/lib/libvcl/vcc_string.c index cb87a03f..c267a8cb 100644 --- a/varnish-cache/lib/libvcl/vcc_string.c +++ b/varnish-cache/lib/libvcl/vcc_string.c @@ -53,6 +53,8 @@ vcc_regexp(struct tokenlist *tl, int sub) int i; Expect(tl, CSTR); + if (tl->err) + return (NULL); memset(&t, 0, sizeof t); i = regcomp(&t, tl->t->dec, REG_EXTENDED | (sub ? 0 : REG_NOSUB)); if (i != 0) { @@ -88,6 +90,8 @@ vcc_regsub(struct tokenlist *tl, int all) Fb(tl, 0, "VRT_regsub(sp, %d, ", all); Expect(tl, '('); + if (tl->err) + return (0); vcc_NextToken(tl); if (!vcc_StringVal(tl)) { @@ -96,14 +100,20 @@ vcc_regsub(struct tokenlist *tl, int all) } Expect(tl, ','); + if (tl->err) + return (0); vcc_NextToken(tl); Expect(tl, CSTR); + if (tl->err) + return (0); p = vcc_regexp(tl, 1); vcc_NextToken(tl); Fb(tl, 0, ", %s, ", p); Expect(tl, ','); + if (tl->err) + return (0); vcc_NextToken(tl); if (!vcc_StringVal(tl)) { @@ -112,6 +122,8 @@ vcc_regsub(struct tokenlist *tl, int all) } Expect(tl, ')'); + if (tl->err) + return (0); vcc_NextToken(tl); Fb(tl, 0, ")");