Commit f5c42c6a authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Return 503 when Vary-headers references header names more than 127

(out limit) characters long.

Fixes: #1274

Test case by: Dag Haavi Finstad
parent f8f75cb1
......@@ -101,6 +101,13 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
for (q = p; *q && !vct_issp(*q) && *q != ','; q++)
continue;
if (q - p > INT8_MAX) {
VSLb(req->vsl, SLT_Error,
"Vary header name length exceeded");
error = 1;
break;
}
/* Build a header-matching string out of it */
VSB_clear(sbh);
VSB_printf(sbh, "%c%.*s:%c",
......
varnishtest "#1274 - panic when Vary field-name is too large to fit in a signed char"
server s1 {
rxreq
# Vary header more than 127 characters long
txresp -hdr "Vary: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
} -start
varnish v1 -vcl+backend { } -start
client c1 {
txreq
rxresp
expect resp.status == 503
} -run
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