diff --git a/headers/compatibility/bsd/string.h b/headers/compatibility/bsd/string.h index 7d194971d1..c19ea27f87 100644 --- a/headers/compatibility/bsd/string.h +++ b/headers/compatibility/bsd/string.h @@ -17,6 +17,7 @@ extern "C" { #endif char* strsep(char** string, const char* delimiters); +void explicit_bzero(void *buf, size_t len); #ifdef __cplusplus } diff --git a/src/libs/bsd/Jamfile b/src/libs/bsd/Jamfile index 2b77ca4cd3..42f2746789 100644 --- a/src/libs/bsd/Jamfile +++ b/src/libs/bsd/Jamfile @@ -13,6 +13,7 @@ for architectureObject in [ MultiArchSubDirSetup ] { SharedLibrary [ MultiArchDefaultGristFiles libbsd.so ] : daemon.c err.c + explicit_bzero.c fgetln.c getpass.c issetugid.c diff --git a/src/libs/bsd/explicit_bzero.c b/src/libs/bsd/explicit_bzero.c new file mode 100644 index 0000000000..359e4d41bf --- /dev/null +++ b/src/libs/bsd/explicit_bzero.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 + +__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); +}