Merge pull request #2036 from ejohnstown/fragsz

TLS Record Fragment Size Check Change
pull/2043/head
David Garske 2019-01-17 08:56:45 -08:00 committed by GitHub
commit 91573735b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -10953,11 +10953,14 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz);
} }
else { else {
if (inputLength + ssl->arrays->pendingMsgOffset word32 pendSz =
> ssl->arrays->pendingMsgSz) { ssl->arrays->pendingMsgSz - ssl->arrays->pendingMsgOffset;
return BUFFER_ERROR; /* Catch the case where there may be the remainder of a fragmented
} * handshake message and the next handshake message in the same
* record. */
if (inputLength > pendSz)
inputLength = pendSz;
XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset, XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset,
input + *inOutIdx, inputLength); input + *inOutIdx, inputLength);
@ -10966,13 +10969,11 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz) if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz)
{ {
word32 idx = 0; word32 idx = HANDSHAKE_HEADER_SZ;
ret = DoHandShakeMsgType(ssl, ret = DoHandShakeMsgType(ssl,
ssl->arrays->pendingMsg ssl->arrays->pendingMsg,
+ HANDSHAKE_HEADER_SZ,
&idx, ssl->arrays->pendingMsgType, &idx, ssl->arrays->pendingMsgType,
ssl->arrays->pendingMsgSz ssl->arrays->pendingMsgSz - idx,
- HANDSHAKE_HEADER_SZ,
ssl->arrays->pendingMsgSz); ssl->arrays->pendingMsgSz);
#ifdef WOLFSSL_ASYNC_CRYPT #ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) { if (ret == WC_PENDING_E) {