[7.3] 084bc093a hpack: Check illegal header blanks with vct_issp()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Oct 24 15:08:14 UTC 2023
commit 084bc093a24725c6516a781f3ddff3967ef25624
Author: Walid Boudebouda <walid.boudebouda at gmail.com>
Date: Fri Sep 8 17:25:06 2023 +0200
hpack: Check illegal header blanks with vct_issp()
Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
diff --git a/bin/varnishd/http2/cache_http2_hpack.c b/bin/varnishd/http2/cache_http2_hpack.c
index 7d9625b41..b57fda191 100644
--- a/bin/varnishd/http2/cache_http2_hpack.c
+++ b/bin/varnishd/http2/cache_http2_hpack.c
@@ -103,7 +103,7 @@ h2h_checkhdr(const struct http *hp, const char *b, size_t namelen, size_t len)
for (p = b + namelen; p < b + len; p++) {
switch(state) {
case FLD_VALUE_FIRST:
- if (*p == ' ' || *p == 0x09) {
+ if (vct_issp(*p)) {
VSLb(hp->vsl, SLT_BogoHeader,
"Illegal field value start %.*s",
(int)(len > 20 ? 20 : len), b);
@@ -123,7 +123,7 @@ h2h_checkhdr(const struct http *hp, const char *b, size_t namelen, size_t len)
WRONG("http2 field value validation state");
}
}
- if (state == FLD_VALUE && b[len - 1] <= 0x20) {
+ if (state == FLD_VALUE && vct_issp(b[len - 1])) {
VSLb(hp->vsl, SLT_BogoHeader,
"Illegal field value (end) %.*s",
(int)(len > 20 ? 20 : len), b);
More information about the varnish-commit
mailing list