Commit 383bc117 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

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

parent e0d1a2f8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);