Skip to content

Commit 668d69b

Browse files
Merge pull request wolfSSL#9988 from kareem-wolfssl/zd21356
Check raw pubkey length in wc_ecc_import_x963 before copying to it for KCAPI case.
2 parents a98cb45 + ddc177b commit 668d69b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wolfcrypt/src/ecc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10742,7 +10742,10 @@ int wc_ecc_import_x963_ex2(const byte* in, word32 inLen, ecc_key* key,
1074210742
XMEMCPY(key->pubkey_raw, (byte*)in, inLen);
1074310743
}
1074410744
#elif defined(WOLFSSL_KCAPI_ECC)
10745-
XMEMCPY(key->pubkey_raw, (byte*)in, inLen);
10745+
if (inLen <= (word32)sizeof(key->pubkey_raw))
10746+
XMEMCPY(key->pubkey_raw, (byte*)in, inLen);
10747+
else
10748+
err = BAD_FUNC_ARG;
1074610749
#endif
1074710750

1074810751
if (err == MP_OKAY) {

0 commit comments

Comments
 (0)