sanity check on buffer size before reading short

This commit is contained in:
Jacob Barthelmeh
2019-08-22 11:36:35 -06:00
parent cf83561b64
commit 65aeb71d6c

View File

@ -8024,6 +8024,8 @@ static int TLSX_PreSharedKey_Parse(WOLFSSL* ssl, byte* input, word16 length,
list = (PreSharedKey*)extension->data; list = (PreSharedKey*)extension->data;
/* Length of binders. */ /* Length of binders. */
if (idx + OPAQUE16_LEN > length)
return BUFFER_E;
ato16(input + idx, &len); ato16(input + idx, &len);
idx += OPAQUE16_LEN; idx += OPAQUE16_LEN;
if (len < MIN_PSK_BINDERS_LEN || length - idx < len) if (len < MIN_PSK_BINDERS_LEN || length - idx < len)