sanity check before reading word16 from buffer

This commit is contained in:
Jacob Barthelmeh 2018-06-20 16:48:40 -06:00
parent 2f43d5eece
commit bf63003237

View File

@ -2866,6 +2866,8 @@ int DoTls13ServerHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
#endif
{
/* Get extension length and length check. */
if ((i - begin) + OPAQUE16_LEN > helloSz)
return BUFFER_ERROR;
ato16(&input[i], &totalExtSz);
i += OPAQUE16_LEN;
if ((i - begin) + totalExtSz > helloSz)