[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    r3546 - trunk/varnish-cache/lib/libvcl
From:       phk () projects ! linpro ! no (phk at projects ! linpro ! no)
Date:       2009-01-27 12:18:12
Message-ID: 20090127121812.CFAE097B4B () projects ! linpro ! no
[Download RAW message or body]

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, ")");
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic