Skip to content

Commit 3250ec6

Browse files
committed
BUG/MINOR: h2/h3: Only test number of trailers inserted in HTX message
When H2 or H3 trailers are inserted in an HTX message, we must take care to not exceed the maximum number of trailers allowed in a message (same than the maximum number of headers, i.e tune.http.maxhdr). However, all HTX blocks in the HTX message were considered. Only TRAILERS HTX blocks must be considered. To fix the issue, in h2_make_htx_trailers(), we rely on the "idx" variable at the end of the for loop. In h3_trailers_to_htx(), we rely on the "hdr_idx" variable. This patch must be backported to all stables versions for the H2 part and as far as 2.8 for the H3 one. pouet
1 parent 9c0aeb3 commit 3250ec6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/h2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,8 @@ int h2_make_htx_trailers(struct http_hdr *list, struct htx *htx)
861861
goto fail;
862862
}
863863

864-
/* Check the number of blocks against "tune.http.maxhdr" value before adding EOT block */
865-
if (htx_nbblks(htx) > global.tune.max_http_hdr)
864+
/* Check the number of trailers against "tune.http.maxhdr" value before adding EOT block */
865+
if (idx > global.tune.max_http_hdr)
866866
goto fail;
867867

868868
if (!htx_add_endof(htx, HTX_BLK_EOT))

src/h3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ static ssize_t h3_trailers_to_htx(struct qcs *qcs, const struct buffer *buf,
15051505
}
15061506

15071507
/* Check the number of blocks against "tune.http.maxhdr" value before adding EOT block */
1508-
if (htx_nbblks(htx) > global.tune.max_http_hdr) {
1508+
if (hdr_idx > global.tune.max_http_hdr) {
15091509
len = -1;
15101510
goto out;
15111511
}

0 commit comments

Comments
 (0)