Date: Fri, 29 Apr 2016 13:58:01 +0000 (UTC) From: Alexey Dokuchaev <danfe@FreeBSD.org> 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 Message-ID: <201604291358.u3TDw1fg089372@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604291358.u3TDw1fg089372>