Author: pfg Date: Fri Jun 3 03:20:54 2016 New Revision: 301233 URL: https://svnweb.freebsd.org/changeset/base/301233
Log: MFC r300322, 300340: ed(1): Cleanups for the DES mode. - Use arc4random_buf(3). - Prevent a segmentation fault when ed receives a signal while being in getpass(). [1] Obtained from: OpenBSD [1] (CVS Rev. 1.15) Modified: stable/10/bin/ed/cbc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/ed/cbc.c ============================================================================== --- stable/10/bin/ed/cbc.c Fri Jun 3 03:12:28 2016 (r301232) +++ stable/10/bin/ed/cbc.c Fri Jun 3 03:20:54 2016 (r301233) @@ -90,16 +90,13 @@ void init_des_cipher(void) { #ifdef DES - int i; - des_ct = des_n = 0; /* initialize the initialization vector */ MEMZERO(ivec, 8); /* initialize the padding vector */ - for (i = 0; i < 8; i++) - pvec[i] = (char) (arc4random() % 256); + arc4random_buf(pvec, sizeof(pvec)); #endif } @@ -164,7 +161,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 _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"