libs/bsd: add explicit_bzero(3)

Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
Leorize
2017-12-16 12:54:58 -05:00
committed by Augustin Cavalier
parent 3d61d20742
commit 0006cc3fbf
3 changed files with 24 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@ extern "C" {
#endif #endif
char* strsep(char** string, const char* delimiters); char* strsep(char** string, const char* delimiters);
void explicit_bzero(void *buf, size_t len);
#ifdef __cplusplus #ifdef __cplusplus
} }
+1
View File
@@ -13,6 +13,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
SharedLibrary [ MultiArchDefaultGristFiles libbsd.so ] : SharedLibrary [ MultiArchDefaultGristFiles libbsd.so ] :
daemon.c daemon.c
err.c err.c
explicit_bzero.c
fgetln.c fgetln.c
getpass.c getpass.c
issetugid.c issetugid.c
+22
View File
@@ -0,0 +1,22 @@
/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */
/*
* Public domain.
* Written by Matthew Dempsky.
*/
#include <string.h>
__attribute__((weak)) void
__explicit_bzero_hook(void *buf, size_t len);
__attribute__((weak)) void
__explicit_bzero_hook(void *buf, size_t len)
{
}
void
explicit_bzero(void *buf, size_t len)
{
memset(buf, 0, len);
__explicit_bzero_hook(buf, len);
}