Found by Coverity Scan
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7511)
(cherry picked from commit
59f90557dd6e35cf72ac72016609d759ac78fcb9)
int ret = 0;
RAND_DRBG *drbg = RAND_DRBG_get0_master();
size_t buflen;
- size_t seedlen = rand_drbg_seedlen(drbg);
+ size_t seedlen;
if (drbg == NULL)
return 0;
if (num < 0 || randomness < 0.0)
return 0;
+ seedlen = rand_drbg_seedlen(drbg);
+
buflen = (size_t)num;
if (buflen < seedlen || randomness < (double) seedlen) {