fix issue where ToTraditional_ex may assign negative value to *pkeySz

This commit is contained in:
Ruby Martin
2026-05-01 14:06:51 -06:00
parent 00e1fa651f
commit 3137d62cf3
+7 -2
View File
@@ -1562,8 +1562,13 @@ int wc_PKCS12_parse_ex(WC_PKCS12* pkcs12, const char* psw,
*pkeySz = (word32)size;
}
else {
*pkeySz = (word32)ToTraditional_ex(*pkey,
(word32)size, &algId);
ret = ToTraditional_ex(*pkey,
(word32)size, &algId);
if (ret < 0) {
*pkeySz = (word32)size;
goto exit_pk12par;
}
*pkeySz = (word32)ret;
}
}