]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: h3: properly reject too long header responses
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 1 Aug 2024 16:20:08 +0000 (18:20 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 9 Aug 2024 15:41:16 +0000 (17:41 +0200)
commit48514c118ce881e2ae20aeb1edda929663a8397d
treee38c5d2dd1461aa8a5182647ec333b9d36e9aea9
parent8939d8e4738e525d809fafff39f9c5b5051ee00c
BUG/MINOR: h3: properly reject too long header responses

When encoding HTX to HTTP/3 headers on the response path, a bunch of
ABORT_NOW() where used when buffer room was not enough. In most cases
this is safe as output buffer has just been allocated and so is empty at
the start of the function. However, with a header list longer than a
whole buffer, this would cause an unexpected crash.

Fix this by removing ABORT_NOW() statement with proper error return
path. For the moment, this would cause the whole connection to be close
rather than the stream only. This may be further improved in the future.

Also remove ABORT_NOW() when encoding frame length at the end of headers
or trailers encoding. Buffer room is sufficient as it was already
checked prior in the same function.

This should be backported up to 2.6. Special care should be handled
however as this code path has changed frequently :
* for 2.9 and older, the extra following statement must be inserted
  prior each newly added goto statement :
  h3c->err = H3_INTERNAL_ERROR;
* for 2.6, trailers support is not implemented. As such, related chunks
  should just be ignored when backporting.
src/h3.c