Date: Fri, 3 Jun 2016 03:22:01 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r301234 - stable/9/bin/ed Message-ID: <201606030322.u533M1d0002615@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Fri Jun 3 03:22:00 2016 New Revision: 301234 URL: https://svnweb.freebsd.org/changeset/base/301234 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/9/bin/ed/cbc.c Directory Properties: stable/9/bin/ed/ (props changed) Modified: stable/9/bin/ed/cbc.c ============================================================================== --- stable/9/bin/ed/cbc.c Fri Jun 3 03:20:54 2016 (r301233) +++ stable/9/bin/ed/cbc.c Fri Jun 3 03:22:00 2016 (r301234) @@ -96,16 +96,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 } @@ -170,7 +167,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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606030322.u533M1d0002615>