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)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to