[7.4] c8e0c6aca hpack: Check illegal header blanks with vct_issp()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Oct 23 17:18:10 UTC 2023
commit c8e0c6aca132a8b6525a105e544675608233d0d9
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 cc33ec78c..35610b616 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