From c4404762701c7073e1f85d7f89834b5ddd59e749 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 31 Oct 2019 19:04:43 -0400 Subject: Use explicit_bzero to clear passwords GNU doesn't implement memset_s, but both FreeBSD and GNU implement explicit_bzero. Darwin doesn't, so #define it in terms of memset_s. --- bounce.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'bounce.c') diff --git a/bounce.c b/bounce.c index b89e90a..49bc0f9 100644 --- a/bounce.c +++ b/bounce.c @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#define __STDC_WANT_LIB_EXT1__ 1 +#include "bounce.h" #include #include @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -33,8 +34,6 @@ #include #include -#include "bounce.h" - #ifndef SIGINFO #define SIGINFO SIGUSR2 #endif @@ -197,8 +196,8 @@ int main(int argc, char *argv[]) { int server = serverConnect(insecure, host, port); stateLogin(pass, auth, nick, user, real); - if (pass) memset_s(pass, strlen(pass), 0, strlen(pass)); - if (auth) memset_s(auth, strlen(auth), 0, strlen(auth)); + if (pass) explicit_bzero(pass, strlen(pass)); + if (auth) explicit_bzero(auth, strlen(auth)); while (!stateReady()) serverRecv(); serverFormat("AWAY :%s\r\n", away); -- cgit 1.4.1
Commit message (Expand)Author
2018-09-08Link gfx man pages in ~/.localJune McEnroe