mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-06 02:50:49 +02:00
guard against heap buffer overflow
This commit is contained in:
+7
-2
@@ -9151,8 +9151,13 @@ int wc_CheckPrivateKeyCert(const byte* key, word32 keySz, DecodedCert* der,
|
||||
if (ret == 0) {
|
||||
if (der->sapkiOID == RSAk || der->sapkiOID == ECDSAk) {
|
||||
/* Simply copy the data */
|
||||
XMEMCPY(decodedPubKey, der->sapkiDer, der->sapkiLen);
|
||||
pubKeyLen = der->sapkiLen;
|
||||
if ((word32)der->sapkiLen > pubKeyLen) {
|
||||
ret = BUFFER_E;
|
||||
}
|
||||
else {
|
||||
XMEMCPY(decodedPubKey, der->sapkiDer, der->sapkiLen);
|
||||
pubKeyLen = der->sapkiLen;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if defined(WC_ENABLE_ASYM_KEY_IMPORT)
|
||||
|
||||
Reference in New Issue
Block a user