From 5cf4afeeae57ca7d0b85f414a700cd401d0a850c Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 11 Aug 2006 11:22:33 +0000 Subject: [PATCH] Until we know of a legitimate use for them, consider non !isgraph() %xx escapes an error. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@810 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvcl/vcc_token.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/varnish-cache/lib/libvcl/vcc_token.c b/varnish-cache/lib/libvcl/vcc_token.c index b6ac5e6b..94eabc36 100644 --- a/varnish-cache/lib/libvcl/vcc_token.c +++ b/varnish-cache/lib/libvcl/vcc_token.c @@ -185,6 +185,7 @@ vcc_decstr(struct tokenlist *tl) { 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_decstr(struct tokenlist *tl) 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'; -- 2.39.5