You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.2 KiB

  1. commit 4fb65f421b4d650711e5d8b9dbcbf4bf589d26cc
  2. Author: Christopher Faulet <cfaulet@haproxy.com>
  3. Date: Wed Jun 19 09:25:58 2019 +0200
  4. BUG/MEDIUM: mux-h2: Remove the padding length when a DATA frame size is checked
  5. When a DATA frame is processed for a message with a content-length, we first
  6. take care to not have a frame size that exceeds the remaining to
  7. read. Otherwise, an error is triggered. But we must remove the padding length
  8. from the frame size because the padding is not included in the announced
  9. content-length.
  10. This patch must be backported to 2.0 and 1.9.
  11. (cherry picked from commit 4f09ec812adbd9336cddc054660a7fb5cd54b459)
  12. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  13. diff --git a/src/mux_h2.c b/src/mux_h2.c
  14. index c06d5d68..5bb85181 100644
  15. --- a/src/mux_h2.c
  16. +++ b/src/mux_h2.c
  17. @@ -2177,7 +2177,7 @@ static int h2c_frt_handle_data(struct h2c *h2c, struct h2s *h2s)
  18. goto strm_err;
  19. }
  20. - if ((h2s->flags & H2_SF_DATA_CLEN) && h2c->dfl > h2s->body_len) {
  21. + if ((h2s->flags & H2_SF_DATA_CLEN) && (h2c->dfl - h2c->dpl) > h2s->body_len) {
  22. /* RFC7540#8.1.2 */
  23. error = H2_ERR_PROTOCOL_ERROR;
  24. goto strm_err;