Skip to content

Commit 1dd6888

Browse files
Merge pull request #6920 from embhorn/zd16909
Fix mem leak in TLSX_CA_Names_Parse
2 parents a17d6ef + 6b0e28f commit 1dd6888

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/tls.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6677,13 +6677,17 @@ static int TLSX_CA_Names_Parse(WOLFSSL *ssl, const byte* input,
66776677
DecodedCert cert[1];
66786678
#endif
66796679

6680-
if (length < OPAQUE16_LEN)
6681-
return BUFFER_ERROR;
6682-
ato16(input, &extLen);
6683-
idx += OPAQUE16_LEN;
6684-
6685-
if (idx + extLen > length)
6680+
if (length < OPAQUE16_LEN) {
66866681
ret = BUFFER_ERROR;
6682+
}
6683+
6684+
if (ret == 0) {
6685+
ato16(input, &extLen);
6686+
idx += OPAQUE16_LEN;
6687+
6688+
if (idx + extLen > length)
6689+
ret = BUFFER_ERROR;
6690+
}
66876691

66886692
if (ret == 0) {
66896693
InitDecodedCert(cert, input + idx, extLen, ssl->heap);

0 commit comments

Comments
 (0)