From owner-svn-src-stable-8@freebsd.org Fri Apr 29 13:58:02 2016 Return-Path: Delivered-To: svn-src-stable-8@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 9A692B21FD1; Fri, 29 Apr 2016 13:58:02 +0000 (UTC) (envelope-from danfe@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 6B701136E; Fri, 29 Apr 2016 13:58:02 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3TDw1AQ089373; Fri, 29 Apr 2016 13:58:01 GMT (envelope-from danfe@FreeBSD.org) Received: (from danfe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3TDw1fg089372; Fri, 29 Apr 2016 13:58:01 GMT (envelope-from danfe@FreeBSD.org) Message-Id: <201604291358.u3TDw1fg089372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: danfe set sender to danfe@FreeBSD.org using -f From: Alexey Dokuchaev Date: Fri, 29 Apr 2016 13:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r298785 - stable/8/bin/ed X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2016 13:58:02 -0000 Author: danfe (ports committer) Date: Fri Apr 29 13:58:01 2016 New Revision: 298785 URL: https://svnweb.freebsd.org/changeset/base/298785 Log: MFC r270256, r298640: ed(1): switch two statements so we check the index before dereferencing. Approved by: pfg Modified: stable/8/bin/ed/cbc.c Directory Properties: stable/8/bin/ed/ (props changed) Modified: stable/8/bin/ed/cbc.c ============================================================================== --- stable/8/bin/ed/cbc.c Fri Apr 29 12:23:56 2016 (r298784) +++ stable/8/bin/ed/cbc.c Fri Apr 29 13:58:01 2016 (r298785) @@ -243,7 +243,7 @@ expand_des_key(char *obuf, char *kbuf) /* * now translate it, bombing on any illegal hex digit */ - for (i = 0; kbuf[i] && i < 16; i++) + for (i = 0; i < 16 && kbuf[i]; i++) if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1) des_error("bad hex digit in key"); while (i < 16) @@ -263,7 +263,7 @@ expand_des_key(char *obuf, char *kbuf) /* * now translate it, bombing on any illegal binary digit */ - for (i = 0; kbuf[i] && i < 16; i++) + for (i = 0; i < 16 && kbuf[i]; i++) if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1) des_error("bad binary digit in key"); while (i < 64)