提交 2ac7753c 编写于 作者: D Dr. Stephen Henson

Fix CRYPTO_clear_realloc() bug.

If allocation in CRYPTO_clear_realloc() fails don't free up the original
buffer: this is consistent with the behaviour of realloc(3) and is expected
in other places in OpenSSL.
Reviewed-by: NRich Salz <rsalz@openssl.org>
Reviewed-by: NRichard Levitte <levitte@openssl.org>
Reviewed-by: NViktor Dukhovni <viktor@openssl.org>
上级 e38bd948
......@@ -201,9 +201,10 @@ void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
}
ret = CRYPTO_malloc(num, file, line);
if (ret)
if (ret != NULL) {
memcpy(ret, str, old_len);
CRYPTO_clear_free(str, old_len, file, line);
CRYPTO_clear_free(str, old_len, file, line);
}
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册