r810 - trunk/varnish-cache/lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Fri Aug 11 13:22:33 CEST 2006


Author: phk
Date: 2006-08-11 13:22:33 +0200 (Fri, 11 Aug 2006)
New Revision: 810

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_token.c
Log:
Until we know of a legitimate use for them, consider non !isgraph()
%xx escapes an error.


Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c	2006-08-11 10:47:40 UTC (rev 809)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c	2006-08-11 11:22:33 UTC (rev 810)
@@ -185,6 +185,7 @@
 {
 	const char *p;
 	char *q;
+	unsigned char u;
 
 	assert(tl->t->tok == CSTR);
 	tl->t->dec = malloc((tl->t->e - tl->t->b) - 1);
@@ -209,7 +210,15 @@
 			vcc_ErrWhere(tl, tl->t);
 			return(1);
 		}
-		*q++ = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]);
+		u = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]);
+		if (!isgraph(u)) {
+			vcc_AddToken(tl, CSTR, p, p + 3);
+			vsb_printf(tl->sb,
+			    "Control character in %%xx escape\n");
+			vcc_ErrWhere(tl, tl->t);
+			return(1);
+		}
+		*q++ = u;
 		p += 3;
 	}
 	*q++ = '\0';




More information about the varnish-commit mailing list