From owner-svn-src-all@freebsd.org Fri Jun 3 03:20:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA8D8B66CB4; Fri, 3 Jun 2016 03:20:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7B8A175B; Fri, 3 Jun 2016 03:20:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u533Ks9q099860; Fri, 3 Jun 2016 03:20:54 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u533KsmR099859; Fri, 3 Jun 2016 03:20:54 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201606030320.u533KsmR099859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 3 Jun 2016 03:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301233 - stable/10/bin/ed X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 03:20:56 -0000 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