Author: pfg
Date: Fri Apr 29 03:12:14 2016
New Revision: 298766
URL: https://svnweb.freebsd.org/changeset/base/298766

Log:
  MFC r298640:
  ed(1): switch two statements so we check the index before dereferencing.

Modified:
  stable/10/bin/ed/cbc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/ed/cbc.c
==============================================================================
--- stable/10/bin/ed/cbc.c      Fri Apr 29 03:06:42 2016        (r298765)
+++ stable/10/bin/ed/cbc.c      Fri Apr 29 03:12:14 2016        (r298766)
@@ -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-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to