Oops, work out expanded buffer length before allocating it...
This commit is contained in:
parent
e0d1a2f80a
commit
383bc117bb
@ -198,11 +198,11 @@ int RAND_status(void)
|
||||
static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
|
||||
int entropy, size_t min_len, size_t max_len)
|
||||
{
|
||||
/* Round up request to multiple of block size */
|
||||
min_len = ((min_len + 19) / 20) * 20;
|
||||
*pout = OPENSSL_malloc(min_len);
|
||||
if (!*pout)
|
||||
return 0;
|
||||
/* Round up request to multiple of block size */
|
||||
min_len = ((min_len + 19) / 20) * 20;
|
||||
if (RAND_SSLeay()->bytes(*pout, min_len) <= 0)
|
||||
{
|
||||
OPENSSL_free(*pout);
|
||||
|
Loading…
x
Reference in New Issue
Block a user