Oops, work out expanded buffer length before allocating it...

This commit is contained in:
Dr. Stephen Henson 2011-04-23 20:24:55 +00:00
parent e0d1a2f80a
commit 383bc117bb

View File

@ -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);