summaryrefslogtreecommitdiffstats
path: root/bin/ed
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
committerpfg <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
commit4f5a56e73cd28662dbe8f81787b0e69ff9e94950 (patch)
tree4246d524af7501e4f9968d21bc586d16a77a75fa /bin/ed
parent5a060fa7839ed3be38abc8f964e12e79ec18cd11 (diff)
downloadFreeBSD-src-4f5a56e73cd28662dbe8f81787b0e69ff9e94950.zip
FreeBSD-src-4f5a56e73cd28662dbe8f81787b0e69ff9e94950.tar.gz
Always check the limits of array index variables before using them.
Obtained from: DragonFlyBSD MFC after: 1 week
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 31838f5..80ed95a 100644
--- a/bin/ed/cbc.c
+++ b/bin/ed/cbc.c
@@ -237,7 +237,7 @@ expand_des_key(char *obuf, char *kbuf)
/*
* now translate it, bombing on any illegal hex 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], 16)) == -1)
des_error("bad hex digit in key");
while (i < 16)
OpenPOWER on IntegriCloud