Skip to content

Commit 679d04d

Browse files
committed
Add bounds check on read in sniffer
1 parent 8093875 commit 679d04d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/sniffer.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,12 +4260,20 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
42604260
idx += idLen;
42614261

42624262
/* Obfuscated Ticket Age 32-bits */
4263+
if (idx + OPAQUE32_LEN > extLen) {
4264+
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
4265+
return WOLFSSL_FATAL_ERROR;
4266+
}
42634267
ticketAge = (word32)((input[idx] << 24) | (input[idx+1] << 16) |
42644268
(input[idx+2] << 8) | input[idx+3]);
42654269
(void)ticketAge; /* not used */
42664270
idx += OPAQUE32_LEN;
42674271

42684272
/* binders - all binders */
4273+
if (idx + OPAQUE16_LEN > extLen) {
4274+
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
4275+
return WOLFSSL_FATAL_ERROR;
4276+
}
42694277
bindersLen = (word16)((input[idx] << 8) | input[idx+1]);
42704278
if (bindersLen + OPAQUE16_LEN + idx > extLen) {
42714279
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);

0 commit comments

Comments
 (0)