Commit 8d9ec0a6 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r3546: 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: http://www.varnish-cache.org/svn/branches/2.0@3728 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c34b028c
......@@ -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, ")");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment