Commit 58167a82 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix an edge-case in vrt_assemble_string(). You will still run out

of workspace, but the message will make more sense...



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4538 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 4f6cb172
......@@ -156,10 +156,11 @@ vrt_assemble_string(struct http *hp, const char *h, const char *p, va_list ap)
if (b + x < e)
memcpy(b, h, x);
b += x;
if (b + 1 < e)
*b++ = ' ';
if (b < e)
*b = ' ';
b++;
}
while (p != vrt_magic_string_end) {
while (p != vrt_magic_string_end && b < e) {
if (p == NULL)
p = "(null)";
x = strlen(p);
......@@ -168,8 +169,9 @@ vrt_assemble_string(struct http *hp, const char *h, const char *p, va_list ap)
b += x;
p = va_arg(ap, const char *);
}
if (b + 1 < e)
*b++ = '\0';
if (b < e)
*b = '\0';
b++;
if (b > e) {
WS_Release(hp->ws, 0);
return (NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment