summaryrefslogtreecommitdiff
path: root/usr.bin/encrypt
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2017-05-03 09:51:40 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2017-05-03 09:51:40 +0000
commitdce3ca59e0bfb31467829ba436634072a5c09a94 (patch)
tree3ee52c1b525fb89cd3731d8ee40a7f42516e8a07 /usr.bin/encrypt
parent88384d18b5e0b1be0b4ae3e5d552e8d0ac317a65 (diff)
Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,
instead of relying on other methods, after readpassphrase. Some programs on this diff won't benefit that much since it happens near the terminal path, but someone might copy the unsafe idiom to another program and place it where it may leak sensitive data. Discussed aeons ago with tb@, OK deraadt@ and beck@
Diffstat (limited to 'usr.bin/encrypt')
-rw-r--r--usr.bin/encrypt/encrypt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c
index 5a80fdd081f..5670929b51d 100644
--- a/usr.bin/encrypt/encrypt.c
+++ b/usr.bin/encrypt/encrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encrypt.c,v 1.45 2016/09/04 15:36:13 tb Exp $ */
+/* $OpenBSD: encrypt.c,v 1.46 2017/05/03 09:51:39 mestre Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -134,6 +134,7 @@ main(int argc, char **argv)
err(1, "readpassphrase");
print_passwd(string, operation, extra);
(void)fputc('\n', stdout);
+ explicit_bzero(string, sizeof(string));
} else {
size_t len;
/* Encrypt stdin to stdout. */