mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-27 10:55:52 +00:00
LibC: Add explicit_bzero()
This is a variant of bzero() that is guaranteed to not get optimized away by the compiler. Useful for clearing out sensitive data.
This commit is contained in:
@@ -476,4 +476,11 @@ size_t strxfrm(char* dest, const char* src, size_t n)
|
||||
dest[i] = '\0';
|
||||
return i;
|
||||
}
|
||||
|
||||
void explicit_bzero(void* ptr, size_t size)
|
||||
{
|
||||
memset(ptr, 0, size);
|
||||
asm volatile("" ::
|
||||
: "memory");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user