Skip to content

Commit 74461e4

Browse files
Code review feedback
1 parent d6c62cc commit 74461e4

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/sniffer.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4231,10 +4231,13 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
42314231
#ifdef WOLFSSL_TLS13
42324232
case EXT_KEY_SHARE:
42334233
{
4234-
if (extLen < OPAQUE16_LEN)
4234+
word16 ksLen = 0;
4235+
if (extLen < OPAQUE16_LEN) {
4236+
SetError(BUFFER_ERROR_STR, error, session, FATAL_ERROR_STATE);
42354237
return BUFFER_ERROR;
4238+
}
42364239

4237-
word16 ksLen = (word16)((input[0] << 8) | input[1]);
4240+
ksLen = (word16)((input[0] << 8) | input[1]);
42384241
if (ksLen + OPAQUE16_LEN > extLen) {
42394242
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
42404243
return WOLFSSL_FATAL_ERROR;
@@ -4258,8 +4261,10 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
42584261
word32 ticketAge;
42594262
const byte *identity, *binders;
42604263

4261-
if (extLen < OPAQUE16_LEN)
4264+
if (extLen < OPAQUE16_LEN) {
4265+
SetError(BUFFER_ERROR_STR, error, session, FATAL_ERROR_STATE);
42624266
return BUFFER_ERROR;
4267+
}
42634268

42644269
idsLen = (word16)((input[idx] << 8) | input[idx+1]);
42654270
if ((word32)idsLen + OPAQUE16_LEN + idx > (word32)extLen) {

src/tls.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3615,7 +3615,9 @@ int ProcessChainOCSPRequest(WOLFSSL* ssl)
36153615
if (chain && chain->buffer) {
36163616
while (ret == 0 && pos + OPAQUE24_LEN < chain->length) {
36173617
if (i >= MAX_CERT_EXTENSIONS) {
3618-
WOLFSSL_MSG("OCSP request cert chain exceeds maximum length.");
3618+
WOLFSSL_ERROR_MSG_EX(
3619+
"OCSP request cert chain exceeds maximum length: "
3620+
"i=%d, MAX_CERT_EXTENSIONS=%d", i, MAX_CERT_EXTENSIONS);
36193621
ret = MAX_CERT_EXTENSIONS_ERR;
36203622
break;
36213623
}

src/tls13.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9151,7 +9151,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
91519151
if (ret != 0)
91529152
return ret;
91539153

9154-
if ((word16)(1 + ssl->buffers.certChainCnt) > MAX_CERT_EXTENSIONS)
9154+
if ((1 + ssl->buffers.certChainCnt) > MAX_CERT_EXTENSIONS)
91559155
ret = MAX_CERT_EXTENSIONS_ERR;
91569156
if (ret == 0)
91579157
ret = WriteCSRToBuffer(ssl, &ssl->buffers.certExts[0], &extSz[0],

0 commit comments

Comments
 (0)