mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
sanity checks
This commit is contained in:
@@ -4957,6 +4957,12 @@ int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength)
|
|||||||
while (align < hdrSz)
|
while (align < hdrSz)
|
||||||
align *= 2;
|
align *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usedLength < 0 || size < 0) {
|
||||||
|
WOLFSSL_MSG("GrowInputBuffer() called with negative number");
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
tmp = (byte*) XMALLOC(size + usedLength + align, ssl->heap,
|
tmp = (byte*) XMALLOC(size + usedLength + align, ssl->heap,
|
||||||
DYNAMIC_TYPE_IN_BUFFER);
|
DYNAMIC_TYPE_IN_BUFFER);
|
||||||
WOLFSSL_MSG("growing input buffer\n");
|
WOLFSSL_MSG("growing input buffer\n");
|
||||||
@@ -7753,8 +7759,12 @@ static int DoDtlsHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
|||||||
ssl->keys.dtls_expected_peer_handshake_number) {
|
ssl->keys.dtls_expected_peer_handshake_number) {
|
||||||
/* Already saw this message and processed it. It can be ignored. */
|
/* Already saw this message and processed it. It can be ignored. */
|
||||||
*inOutIdx += fragSz;
|
*inOutIdx += fragSz;
|
||||||
if(type == finished )
|
if(type == finished ) {
|
||||||
|
if (*inOutIdx + ssl->keys.padSz > totalSz) {
|
||||||
|
return BUFFER_E;
|
||||||
|
}
|
||||||
*inOutIdx += ssl->keys.padSz;
|
*inOutIdx += ssl->keys.padSz;
|
||||||
|
}
|
||||||
ret = DtlsPoolSend(ssl);
|
ret = DtlsPoolSend(ssl);
|
||||||
}
|
}
|
||||||
else if (fragSz < size) {
|
else if (fragSz < size) {
|
||||||
|
Reference in New Issue
Block a user