mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-29 22:53:57 +00:00
Added helper method to securely scrub memory
This commit is contained in:
@@ -56,7 +56,7 @@ duk_ret_t duk_fixed_buffer_finalizer(duk_context *ctx)
|
||||
{
|
||||
duk_size_t bufLen;
|
||||
char *buf = (char*)Duktape_GetBuffer(ctx, 0, &bufLen);
|
||||
memset(buf, 0, bufLen);
|
||||
ILibMemory_SecureZero(buf, bufLen);
|
||||
return(0);
|
||||
}
|
||||
void duk_buffer_enable_autoclear(duk_context *ctx)
|
||||
|
||||
@@ -1559,7 +1559,7 @@ void ILibDuktape_ScriptContainer_Engine_free(void *udata, void *ptr)
|
||||
if (ptr != NULL)
|
||||
{
|
||||
ILibDuktape_ScriptContainer_TotalAllocations -= ILibMemory_Size(ptr);
|
||||
memset(ptr, 0xDEADBEEF, sz);
|
||||
ILibMemory_SecureZero(ptr, sz);
|
||||
ILibMemory_Free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user