Commit 9701bc56 authored by Nils Goroll's avatar Nils Goroll

mark workspace overflows where some WS_Reserve() was insufficient

parent cab6b138
......@@ -379,6 +379,7 @@ http_CollectHdrSep(struct http *hp, const char *hdr, const char *sep)
if (b + x >= e) {
http_fail(hp);
VSLb(hp->vsl, SLT_LostHeader, "%s", hdr + 1);
WS_MarkOverflow(hp->ws);
WS_Release(hp->ws, 0);
return;
}
......
......@@ -207,6 +207,10 @@ VRT_String(struct ws *ws, const char *h, const char *p, va_list ap)
}
b = VRT_StringList(b, e > b ? e - b : 0, p, ap);
if (b == NULL || b == e) {
/*
* NO WS_MarkOverflow here because the caller might have a
* fallback
*/
WS_Release(ws, 0);
return (NULL);
}
......
......@@ -86,6 +86,7 @@ vmod_updown(VRT_CTX, int up, const char *s, va_list ap)
*b = '\0';
b++;
if (b > e) {
WS_MarkOverflow(ctx->ws);
WS_Release(ctx->ws, 0);
return (NULL);
} else {
......@@ -146,9 +147,17 @@ vmod_log(VRT_CTX, const char *fmt, ...)
va_start(ap, fmt);
p = VRT_String(ctx->ws, NULL, fmt, ap);
va_end(ap);
if (p != NULL && ctx->vsl != NULL)
if (p == NULL) {
WS_MarkOverflow(ctx->ws);
WS_Reset(ctx->ws, sn);
return;
}
AN(p);
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_Log, "%s", p);
else if (p != NULL)
else
VSL(SLT_VCL_Log, 0, "%s", p);
WS_Reset(ctx->ws, sn);
}
......@@ -165,8 +174,15 @@ vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...)
va_start(ap, fmt);
p = VRT_String(ctx->ws, NULL, fmt, ap);
va_end(ap);
if (p != NULL)
syslog((int)fac, "%s", p);
if (p == NULL) {
WS_MarkOverflow(ctx->ws);
WS_Reset(ctx->ws, sn);
return;
}
AN(p);
syslog((int)fac, "%s", p);
WS_Reset(ctx->ws, sn);
}
......
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