]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: h2: ":path" must not be empty
authorWilly Tarreau <w@1wt.eu>
Sun, 3 Dec 2017 10:51:31 +0000 (11:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 3 Dec 2017 20:08:41 +0000 (21:08 +0100)
As reported by h2spec, the h2->h1 gateway doesn't verify that ":path"
is not empty. This is harmless since the H1 parser will reject such a
request, but better fix it anyway.

To backport to 1.8.

src/h2.c

index 183b7c374ebc36e96b2031556726010ca07c7694..3c580d196847074f33a3004f4a337ebc33a1ec69 100644 (file)
--- a/src/h2.c
+++ b/src/h2.c
@@ -83,6 +83,10 @@ static int h2_prepare_h1_reqline(uint32_t fields, struct ist *phdr, char **ptr,
                }
        }
 
+       /* 7540#8.1.2.3: :path must not be empty */
+       if (!phdr[uri_idx].len)
+               goto fail;
+
        if (out + phdr[H2_PHDR_IDX_METH].len + 1 + phdr[uri_idx].len + 11 > end) {
                /* too large */
                goto fail;