Browse Source

Use explicit_memset from NetBSD if available for safe_memclear (fixes #2971)

personal/stbuehler/ci-build
Stefan Bühler 2 years ago
parent
commit
79760d935a
  1. 1
      configure.ac
  2. 4
      src/safe_memclear.c

1
configure.ac

@ -1211,6 +1211,7 @@ AC_CHECK_FUNCS([\
clock_gettime \
epoll_ctl \
explicit_bzero \
explicit_memset \
fork \
getloadavg \
getrlimit \

4
src/safe_memclear.c

@ -4,7 +4,7 @@
#include <string.h>
#if !defined(HAVE_MEMSET_S) && !defined(HAVE_EXPLICIT_BZERO)
#if !defined(HAVE_MEMSET_S) && !defined(HAVE_EXPLICIT_BZERO) && !defined(HAVE_EXPLICIT_MEMSET)
# if defined(HAVE_WEAK_SYMBOLS)
/* it seems weak functions are never inlined, even for static builds */
@ -41,6 +41,8 @@ void safe_memclear(void *s, size_t n) {
memset_s(s, n, 0, n);
#elif defined(HAVE_EXPLICIT_BZERO)
explicit_bzero(s, n);
#elif defined(HAVE_EXPLICIT_MEMSET)
explicit_memset(s, 0, n);
#else
safe_memset(s, 0, n);
#endif

Loading…
Cancel
Save