mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
MFC r270256, r298640:
ed(1): switch two statements so we check the index before dereferencing. Approved by: pfg
This commit is contained in:
parent
0c318c36db
commit
89af640651
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=298785
@ -243,7 +243,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)
|
||||
@ -263,7 +263,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)
|
||||
|
Loading…
Reference in New Issue
Block a user