summaryrefslogtreecommitdiffstats
path: root/bin/ed
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-29 03:12:14 +0000
committerpfg <pfg@FreeBSD.org>2016-04-29 03:12:14 +0000
commitd58ddf1ae8d432c467a7432104842a4e0d70d32a (patch)
tree5db6c798ea3254d0084e24cb3e6e28cb1aa6dcbb /bin/ed
parenta9fdf41ec64def827399987a18b5ae4bb505b248 (diff)
downloadFreeBSD-src-d58ddf1ae8d432c467a7432104842a4e0d70d32a.zip
FreeBSD-src-d58ddf1ae8d432c467a7432104842a4e0d70d32a.tar.gz
MFC r298640:
ed(1): switch two statements so we check the index before dereferencing.
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/cbc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c
index 80ed95a..3985721 100644
--- a/bin/ed/cbc.c
+++ b/bin/ed/cbc.c
@@ -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)
OpenPOWER on IntegriCloud