mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
F-11238: validate arguments before use in the A100 verify path
The A100/A110 stsafe_verify wrote *pResult before validating any of its arguments, unlike the A120 variant which rejects NULL inputs. Move the argument validation (pointers plus hashSz) ahead of the *pResult write and the buffer allocation, so a NULL argument returns BAD_FUNC_ARG instead of dereferencing, and the early return happens before the SMALL_STACK buffers are allocated. Addresses the PR review note on *pResult before validation.
This commit is contained in:
@@ -822,12 +822,13 @@ static int stsafe_verify(stsafe_curve_id_t curve_id, uint8_t* pHash,
|
||||
#endif
|
||||
StSafeA_VerifySignatureBuffer* Verif = NULL;
|
||||
|
||||
*pResult = 0;
|
||||
|
||||
if (hashSz == 0) {
|
||||
if (pHash == NULL || pSigRS == NULL || pPubKeyX == NULL ||
|
||||
pPubKeyY == NULL || pResult == NULL || hashSz == 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
|
||||
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
||||
/* Allocate buffers */
|
||||
R = (StSafeA_SignatureBuffer*)XMALLOC(key_sz + 2, NULL,
|
||||
|
||||
Reference in New Issue
Block a user