Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Apr 2016 14:31:48 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r298640 - head/bin/ed
Message-ID:  <201604261431.u3QEVm3w026135@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Apr 26 14:31:48 2016
New Revision: 298640
URL: https://svnweb.freebsd.org/changeset/base/298640

Log:
  ed(1): switch two statements so we check the index before dereferencing.
  
  This is related to r270256 but was missed in that occasion.
  
  MFC after:	3 days

Modified:
  head/bin/ed/cbc.c

Modified: head/bin/ed/cbc.c
==============================================================================
--- head/bin/ed/cbc.c	Tue Apr 26 14:21:39 2016	(r298639)
+++ head/bin/ed/cbc.c	Tue Apr 26 14:31:48 2016	(r298640)
@@ -257,7 +257,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?201604261431.u3QEVm3w026135>