Skip to content

Commit 041bb29

Browse files
committed
Use OPENSSL_clear_free()
1 parent 3cf6a7b commit 041bb29

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/crypto/crypto_dh.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,16 @@ Local<Value> StatelessDiffieHellman(
578578
&out_size))
579579
return Undefined(env->isolate());
580580

581+
void* hint = reinterpret_cast<void*>(static_cast<uintptr_t>(out_size));
581582
return Buffer::New(env,
582583
buf,
583584
out_size,
584585
[](char* data, void* hint) {
585-
OPENSSL_free(data);
586+
size_t out_size = static_cast<size_t>(
587+
reinterpret_cast<uintptr_t>(hint));
588+
OPENSSL_clear_free(data, out_size);
586589
},
587-
nullptr).FromMaybe(Local<Object>());
590+
hint).FromMaybe(Local<Object>());
588591
}
589592

590593
// The version of StatelessDiffieHellman that returns a Buffer

0 commit comments

Comments
 (0)