From: phk Date: Fri, 11 Aug 2006 11:22:33 +0000 (+0000) Subject: Until we know of a legitimate use for them, consider non !isgraph() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cf4afeeae57ca7d0b85f414a700cd401d0a850c;p=varnish 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 --- 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';