Replace flawed memset_s usage

memset_s() has a different signature than memset(3) or explicit_bzero(),
thus the current code would not compile.  Also memset_s()
implementations are quite rare.
Use the C23 standardized version memset_explicit(3).

Fixes: 7a799ebb ("Ensure memory cleaning")
This commit is contained in:
Christian Göttsche 2023-01-24 15:39:41 +01:00 committed by Iker Pedrosa
parent b2bed465e8
commit 90ead3cfb8
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ AC_CHECK_FUNCS(arc4random_buf futimes \
getutent initgroups lckpwdf lutimes \
setgroups updwtmp updwtmpx innetgr \
getspnam_r \
memset_s explicit_bzero)
memset_explicit explicit_bzero)
AC_SYS_LARGEFILE
dnl Checks for typedefs, structures, and compiler characteristics.

View File

@ -47,8 +47,8 @@
#include <sys/time.h>
#include <time.h>
#ifdef HAVE_MEMSET_S
# define memzero(ptr, size) memset_s((ptr), 0, (size))
#ifdef HAVE_MEMSET_EXPLICIT
# define memzero(ptr, size) memset_explicit((ptr), 0, (size))
#elif defined HAVE_EXPLICIT_BZERO /* !HAVE_MEMSET_S */
# define memzero(ptr, size) explicit_bzero((ptr), (size))
#else /* !HAVE_MEMSET_S && HAVE_EXPLICIT_BZERO */