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:
parent
b2bed465e8
commit
90ead3cfb8
@ -50,7 +50,7 @@ AC_CHECK_FUNCS(arc4random_buf futimes \
|
|||||||
getutent initgroups lckpwdf lutimes \
|
getutent initgroups lckpwdf lutimes \
|
||||||
setgroups updwtmp updwtmpx innetgr \
|
setgroups updwtmp updwtmpx innetgr \
|
||||||
getspnam_r \
|
getspnam_r \
|
||||||
memset_s explicit_bzero)
|
memset_explicit explicit_bzero)
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
@ -47,8 +47,8 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef HAVE_MEMSET_S
|
#ifdef HAVE_MEMSET_EXPLICIT
|
||||||
# define memzero(ptr, size) memset_s((ptr), 0, (size))
|
# define memzero(ptr, size) memset_explicit((ptr), 0, (size))
|
||||||
#elif defined HAVE_EXPLICIT_BZERO /* !HAVE_MEMSET_S */
|
#elif defined HAVE_EXPLICIT_BZERO /* !HAVE_MEMSET_S */
|
||||||
# define memzero(ptr, size) explicit_bzero((ptr), (size))
|
# define memzero(ptr, size) explicit_bzero((ptr), (size))
|
||||||
#else /* !HAVE_MEMSET_S && HAVE_EXPLICIT_BZERO */
|
#else /* !HAVE_MEMSET_S && HAVE_EXPLICIT_BZERO */
|
||||||
|
Loading…
Reference in New Issue
Block a user