Fix mem leak in TLSX_CA_Names_Parse

This commit is contained in:
Eric Blankenhorn 2023-10-27 07:58:50 -05:00
parent 45ba778692
commit 6b0e28f840

View File

@ -6677,13 +6677,17 @@ static int TLSX_CA_Names_Parse(WOLFSSL *ssl, const byte* input,
DecodedCert cert[1];
#endif
if (length < OPAQUE16_LEN)
return BUFFER_ERROR;
ato16(input, &extLen);
idx += OPAQUE16_LEN;
if (idx + extLen > length)
if (length < OPAQUE16_LEN) {
ret = BUFFER_ERROR;
}
if (ret == 0) {
ato16(input, &extLen);
idx += OPAQUE16_LEN;
if (idx + extLen > length)
ret = BUFFER_ERROR;
}
if (ret == 0) {
InitDecodedCert(cert, input + idx, extLen, ssl->heap);