Fix buffer overflow in GetOID

When converting BER to DER we switched the pointer for pkiMsg to the DER
but not the size which could cause buffer overflow.

Fixes ZD13471
This commit is contained in:
Andrew Hutchings
2022-01-13 13:26:32 +00:00
parent c7b0b7003e
commit 92d01611ff

View File

@ -10497,8 +10497,10 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* in,
#ifdef ASN_BER_TO_DER #ifdef ASN_BER_TO_DER
/* check if content was BER and has been converted to DER */ /* check if content was BER and has been converted to DER */
if (pkcs7->derSz > 0) if (pkcs7->derSz > 0) {
pkiMsg = in = pkcs7->der; pkiMsg = in = pkcs7->der;
pkiMsgSz = inSz = pkcs7->derSz;
}
#endif #endif
decryptedKey = (byte*)XMALLOC(MAX_ENCRYPTED_KEY_SZ, pkcs7->heap, decryptedKey = (byte*)XMALLOC(MAX_ENCRYPTED_KEY_SZ, pkcs7->heap,