summaryrefslogtreecommitdiff
path: root/bin/ed
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2014-08-21 02:40:33 +0000
commit0fa46a42318ad56f1414d2822c6ab82e72dde6fa (patch)
tree4246d524af7501e4f9968d21bc586d16a77a75fa /bin/ed
parentf8cdacdd185481cc34c8241acf12e92eb71bca44 (diff)
downloadsrc-test-0fa46a42318ad56f1414d2822c6ab82e72dde6fa.tar.gz
src-test-0fa46a42318ad56f1414d2822c6ab82e72dde6fa.zip
Always check the limits of array index variables before using them.
Obtained from: DragonFlyBSD MFC after: 1 week
Notes
Notes: svn path=/head/; revision=270256
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 31838f5e6663a..80ed95a5ebf98 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)