r3728 - branches/2.0/varnish-cache/lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Wed Feb 11 07:55:23 CET 2009


Author: tfheen
Date: 2009-02-11 07:55:23 +0100 (Wed, 11 Feb 2009)
New Revision: 3728

Modified:
   branches/2.0/varnish-cache/lib/libvcl/vcc_string.c
Log:
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



Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_string.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_string.c	2009-02-10 15:10:04 UTC (rev 3727)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_string.c	2009-02-11 06:55:23 UTC (rev 3728)
@@ -53,6 +53,8 @@
 	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 @@
 	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 @@
 	}
 
 	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 @@
 	}
 
 	Expect(tl, ')');
+	if (tl->err)
+		return (0);
 	vcc_NextToken(tl);
 	Fb(tl, 0, ")");
 



More information about the varnish-commit mailing list