libs/bsd: add explicit_bzero(3)
Signed-off-by: Augustin Cavalier <[email protected]>
This commit is contained in:
committed by
Augustin Cavalier
parent
3d61d20742
commit
0006cc3fbf
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user