forked from wolfSSL/wolfssl
added sanity check on return from recv callback
This commit is contained in:
@ -108,6 +108,7 @@ enum CyaSSL_ErrorCodes {
|
|||||||
OUT_OF_ORDER_E = -273, /* out of order message */
|
OUT_OF_ORDER_E = -273, /* out of order message */
|
||||||
BAD_KEA_TYPE_E = -274, /* bad KEA type found */
|
BAD_KEA_TYPE_E = -274, /* bad KEA type found */
|
||||||
SANITY_CIPHER_E = -275, /* sanity check on cipher error */
|
SANITY_CIPHER_E = -275, /* sanity check on cipher error */
|
||||||
|
RECV_OVERFLOW_E = -276, /* RXCB returned more than rqed */
|
||||||
/* add strings to SetErrorString !!!!! */
|
/* add strings to SetErrorString !!!!! */
|
||||||
|
|
||||||
/* begin negotiation parameter errors */
|
/* begin negotiation parameter errors */
|
||||||
|
@ -3856,6 +3856,9 @@ static int GetInputData(CYASSL *ssl, word32 size)
|
|||||||
|
|
||||||
if (in == WANT_READ)
|
if (in == WANT_READ)
|
||||||
return WANT_READ;
|
return WANT_READ;
|
||||||
|
|
||||||
|
if (in > inSz)
|
||||||
|
return RECV_OVERFLOW_E;
|
||||||
|
|
||||||
ssl->buffers.inputBuffer.length += in;
|
ssl->buffers.inputBuffer.length += in;
|
||||||
inSz -= in;
|
inSz -= in;
|
||||||
@ -5177,6 +5180,10 @@ void SetErrorString(int error, char* str)
|
|||||||
XSTRNCPY(str, "Sanity check on ciphertext failed", max);
|
XSTRNCPY(str, "Sanity check on ciphertext failed", max);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RECV_OVERFLOW_E:
|
||||||
|
XSTRNCPY(str, "Receive callback returned more than requested", max);
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
XSTRNCPY(str, "unknown error number", max);
|
XSTRNCPY(str, "unknown error number", max);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user