r3258 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 6 00:40:17 CEST 2008


Author: phk
Date: 2008-10-06 00:40:16 +0200 (Mon, 06 Oct 2008)
New Revision: 3258

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_token.c
Log:
Fix error handling of unterminated long-strings.



Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-10-05 22:28:13 UTC (rev 3257)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c	2008-10-05 22:40:16 UTC (rev 3258)
@@ -400,18 +400,19 @@
 			for (q = p + 2; q < sp->e; q++) {
 				if (*q == '"' && q[1] == '}') {
 					vcc_AddToken(tl, CSTR, p, q + 2);
-					p = q + 2;
 					break;
 				}
 			}
-			u = tl->t->e - tl->t->b;
-			u -= 4; 	/* {" ... "} */
-			tl->t->dec = TlAlloc(tl, u + 1 );
-			AN(tl->t->dec);
-			memcpy(tl->t->dec, tl->t->b + 2, u);
-			tl->t->dec[u] = '\0';
-			if (q < sp->e)
+			if (q < sp->e) {
+				p = q + 2;
+				u = tl->t->e - tl->t->b;
+				u -= 4; 	/* {" ... "} */
+				tl->t->dec = TlAlloc(tl, u + 1 );
+				AN(tl->t->dec);
+				memcpy(tl->t->dec, tl->t->b + 2, u);
+				tl->t->dec[u] = '\0';
 				continue;
+			}
 			vcc_AddToken(tl, EOI, p, p + 2);
 			vsb_printf(tl->sb,
 			    "Unterminated long-string, starting at\n");




More information about the varnish-commit mailing list