r3546 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Tue Jan 27 13:18:12 CET 2009


Author: phk
Date: 2009-01-27 13:18:12 +0100 (Tue, 27 Jan 2009)
New Revision: 3546

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_string.c
Log:
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: trunk/varnish-cache/lib/libvcl/vcc_string.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_string.c	2009-01-27 08:46:51 UTC (rev 3545)
+++ trunk/varnish-cache/lib/libvcl/vcc_string.c	2009-01-27 12:18:12 UTC (rev 3546)
@@ -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