From 830435eb538e03502a83f0036bdede108c02f9bb Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 5 Oct 2008 22:40:16 +0000 Subject: [PATCH] Fix error handling of unterminated long-strings. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3258 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvcl/vcc_token.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/varnish-cache/lib/libvcl/vcc_token.c b/varnish-cache/lib/libvcl/vcc_token.c index 787ed188..d8960760 100644 --- a/varnish-cache/lib/libvcl/vcc_token.c +++ b/varnish-cache/lib/libvcl/vcc_token.c @@ -400,18 +400,19 @@ vcc_Lexer(struct tokenlist *tl, struct source *sp) 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"); -- 2.39.5