Add parameter check

This commit is contained in:
Tesfa Mael
2020-12-28 15:53:56 -08:00
parent 4280861af0
commit cedec3ae28
2 changed files with 2 additions and 2 deletions

View File

@ -914,7 +914,7 @@ int wc_RNG_GenerateBlock(WC_RNG* rng, byte* output, word32 sz)
{
int ret;
if (rng == NULL || output == NULL)
if (rng == NULL || output == NULL || sz == 0 )
return BAD_FUNC_ARG;
#ifdef WOLF_CRYPTO_CB

View File

@ -12979,7 +12979,7 @@ int sp_rand_prime(sp_int* r, int len, WC_RNG* rng, void* heap)
(void)heap;
if ((r == NULL) || (rng == NULL)) {
if ((r == NULL) || (rng == NULL) || len <= 0 ) {
err = MP_VAL;
}