mirror of https://github.com/i3/i3lock.git
Use explicit_bzero() where available, not just on OpenBSD (#282)
parent
79d102a70d
commit
9f675b8a85
|
@ -66,6 +66,7 @@ AC_FUNC_FORK
|
|||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
AC_FUNC_STRNLEN
|
||||
AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3lock requires])])
|
||||
AC_CHECK_FUNCS([explicit_bzero])
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
|
|
5
i3lock.c
5
i3lock.c
|
@ -27,7 +27,6 @@
|
|||
#include <security/pam_appl.h>
|
||||
#endif
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <ev.h>
|
||||
#include <sys/mman.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
@ -35,7 +34,7 @@
|
|||
#include <xkbcommon/xkbcommon-x11.h>
|
||||
#include <cairo.h>
|
||||
#include <cairo/cairo-xcb.h>
|
||||
#ifdef __OpenBSD__
|
||||
#ifdef HAVE_EXPLICIT_BZERO
|
||||
#include <strings.h> /* explicit_bzero(3) */
|
||||
#endif
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
@ -175,7 +174,7 @@ static bool load_compose_table(const char *locale) {
|
|||
*
|
||||
*/
|
||||
static void clear_password_memory(void) {
|
||||
#ifdef __OpenBSD__
|
||||
#ifdef HAVE_EXPLICIT_BZERO
|
||||
/* Use explicit_bzero(3) which was explicitly designed not to be
|
||||
* optimized out by the compiler. */
|
||||
explicit_bzero(password, strlen(password));
|
||||
|
|
Loading…
Reference in New Issue