提交 383bc117 编写于 作者: D Dr. Stephen Henson

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

上级 e0d1a2f8
...@@ -198,11 +198,11 @@ int RAND_status(void) ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册