Oops, work out expanded buffer length before allocating it...
This commit is contained in:
@@ -198,11 +198,11 @@ int RAND_status(void)
|
|||||||
static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
|
static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
|
||||||
int entropy, size_t min_len, size_t max_len)
|
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);
|
*pout = OPENSSL_malloc(min_len);
|
||||||
if (!*pout)
|
if (!*pout)
|
||||||
return 0;
|
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)
|
if (RAND_SSLeay()->bytes(*pout, min_len) <= 0)
|
||||||
{
|
{
|
||||||
OPENSSL_free(*pout);
|
OPENSSL_free(*pout);
|
||||||
|
|||||||
Reference in New Issue
Block a user