svn commit: r298640 - head/bin/ed

Pedro F. Giffuni pfg at FreeBSD.org
Tue Apr 26 14:31:49 UTC 2016


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)


More information about the svn-src-all mailing list