Skip to content

Commit 6840488

Browse files
MegaManSecgstrauss
authored andcommitted
[h2] add comment about zero-length payloads in padded frames
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com> Co-authored-by: Glenn Strauss <gstrauss@gluelogic.com> x-ref: "h2: guard PADDED frames with zero-length payload" #146 github: closes #146
1 parent fcf0f67 commit 6840488

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/h2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ h2_recv_data (connection * const con, const uint8_t * const s, const uint32_t le
11881188
uint32_t alen = len; /* actual data len, minus padding */
11891189
uint32_t pad = 0;
11901190
if (s[4] & H2_FLAG_PADDED) {
1191-
pad = s[9];
1191+
pad = s[9]; /*(reads '\0' after string if 0 == len)*/
11921192
if (pad >= len) {
11931193
h2_send_goaway_e(con, H2_E_PROTOCOL_ERROR);
11941194
return 0;
@@ -1868,7 +1868,7 @@ h2_recv_headers (connection * const con, uint8_t * const s, uint32_t flen)
18681868
uint32_t alen = flen;
18691869
if (s[4] & H2_FLAG_PADDED) {
18701870
++psrc;
1871-
const uint32_t pad = s[9];
1871+
const uint32_t pad = s[9]; /*(reads '\0' after string if 0 == alen)*/
18721872
if (alen < 1 + pad) {
18731873
/* Padding that exceeds the size remaining for the header block
18741874
* fragment MUST be treated as a PROTOCOL_ERROR. */

0 commit comments

Comments
 (0)