summary refs log tree commit diff
path: root/bounce.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-31 19:04:43 -0400
committerJune McEnroe <june@causal.agency>2019-10-31 19:04:43 -0400
commitc4404762701c7073e1f85d7f89834b5ddd59e749 (patch)
treebbe1d574587f2e6d5841d2c49fb7eb4018839eef /bounce.c
parentSend clients their own QUIT on shutdown (diff)
downloadpounce-c4404762701c7073e1f85d7f89834b5ddd59e749.tar.gz
pounce-c4404762701c7073e1f85d7f89834b5ddd59e749.zip
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.
Diffstat (limited to '')
-rw-r--r--bounce.c9
1 files changed, 4 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>.
  */
 
-#define __STDC_WANT_LIB_EXT1__ 1
+#include "bounce.h"
 
 #include <assert.h>
 #include <err.h>
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <sys/file.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -33,8 +34,6 @@
 #include <tls.h>
 #include <unistd.h>
 
-#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);