Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/sniffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4243,15 +4243,15 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
const byte *identity, *binders;

idsLen = (word16)((input[idx] << 8) | input[idx+1]);
if (idsLen + OPAQUE16_LEN + idx > extLen) {
if ((word32)idsLen + OPAQUE16_LEN + idx > (word32)extLen) {
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
return WOLFSSL_FATAL_ERROR;
}
idx += OPAQUE16_LEN;

/* PSK identity */
idLen = (word16)((input[idx] << 8) | input[idx+1]);
if (idLen + OPAQUE16_LEN + idx > extLen) {
if ((word32)idLen + OPAQUE16_LEN + idx > (word32)extLen) {
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
return WOLFSSL_FATAL_ERROR;
}
Expand All @@ -4260,14 +4260,22 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
idx += idLen;

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

/* binders - all binders */
if ((word32)idx + OPAQUE16_LEN > (word32)extLen) {
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
return WOLFSSL_FATAL_ERROR;
}
bindersLen = (word16)((input[idx] << 8) | input[idx+1]);
if (bindersLen + OPAQUE16_LEN + idx > extLen) {
if ((word32)bindersLen + OPAQUE16_LEN + idx > (word32)extLen) {
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
return WOLFSSL_FATAL_ERROR;
}
Expand Down