Replace memset with OPENSSL_clear_free()
BUF_MEM_free() attempts to cleanse memory using memset immediately prior to a free. This is at risk of being optimised away by the compiler, so replace with a call to OPENSSL_clear_free() instead. With thanks to the Open Crypto Audit Project for reporting this issue. Reviewed-by: Stephen Henson <steve@openssl.org>
This commit is contained in:
parent
e36c5fc4f5
commit
5d80fab086
1 changed files with 1 additions and 2 deletions
|
@ -88,8 +88,7 @@ void BUF_MEM_free(BUF_MEM *a)
|
|||
return;
|
||||
|
||||
if (a->data != NULL) {
|
||||
memset(a->data, 0, (unsigned int)a->max);
|
||||
OPENSSL_free(a->data);
|
||||
OPENSSL_clear_free(a->data, a->max);
|
||||
}
|
||||
OPENSSL_free(a);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue