summaryrefslogtreecommitdiffstats
path: root/bin/ed
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-20 19:10:29 +0000
committerpfg <pfg@FreeBSD.org>2016-05-20 19:10:29 +0000
commitaa7ae54edb4c8fafb3756c0be4235a3c3c7f3d3b (patch)
tree97c673cab358ed23a2d8bc6c4f66b074ebdeeb8f /bin/ed
parente171aa4de413b7c6477e2e97b1a2f19e33fcc870 (diff)
downloadFreeBSD-src-aa7ae54edb4c8fafb3756c0be4235a3c3c7f3d3b.zip
FreeBSD-src-aa7ae54edb4c8fafb3756c0be4235a3c3c7f3d3b.tar.gz
ed(1): Cleanups for the DES mode.
- Use arc4random_uniform(3). - Prevent a segmentation fault when ed receives a signal while being in getpass(). [1] Obtained from: OpenBSD [1] (CVS Rev. 1.15) MFC after: 2 weeks
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/cbc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c
index 3985721..7869e96 100644
--- a/bin/ed/cbc.c
+++ b/bin/ed/cbc.c
@@ -99,7 +99,7 @@ init_des_cipher(void)
/* initialize the padding vector */
for (i = 0; i < 8; i++)
- pvec[i] = (char) (arc4random() % 256);
+ pvec[i] = (char)arc4random_uniform(256);
#endif
}
@@ -164,7 +164,7 @@ get_keyword(void)
/*
* get the key
*/
- if (*(p = getpass("Enter key: "))) {
+ if ((p = getpass("Enter key: ")) != NULL && *p != '\0') {
/*
* copy it, nul-padded, into the key area
OpenPOWER on IntegriCloud