Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ed PR/50734: David Binderman: check bounds before derefe...
details: https://anonhg.NetBSD.org/src/rev/dbdf0707b500
branches: trunk
changeset: 813534:dbdf0707b500
user: christos <christos%NetBSD.org@localhost>
date: Mon Feb 01 17:34:00 2016 +0000
description:
PR/50734: David Binderman: check bounds before dereferencing.
diffstat:
bin/ed/cbc.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r f7db8b86f908 -r dbdf0707b500 bin/ed/cbc.c
--- a/bin/ed/cbc.c Mon Feb 01 16:53:23 2016 +0000
+++ b/bin/ed/cbc.c Mon Feb 01 17:34:00 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cbc.c,v 1.23 2014/03/23 05:06:42 dholland Exp $ */
+/* $NetBSD: cbc.c,v 1.24 2016/02/01 17:34:00 christos Exp $ */
/* cbc.c: This file contains the encryption routines for the ed line editor */
/*-
@@ -72,7 +72,7 @@
#if 0
static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp";
#else
-__RCSID("$NetBSD: cbc.c,v 1.23 2014/03/23 05:06:42 dholland Exp $");
+__RCSID("$NetBSD: cbc.c,v 1.24 2016/02/01 17:34:00 christos Exp $");
#endif
#endif /* not lint */
@@ -303,7 +303,7 @@
/*
* now translate it, bombing on any illegal hex digit
*/
- for (i = 0; inbuf[i] && i < 16; i++)
+ for (i = 0; i < 16 && inbuf[i]; i++)
if ((nbuf[i] = hex_to_binary((int) inbuf[i], 16)) == -1)
des_error("bad hex digit in key");
while (i < 16)
@@ -323,7 +323,7 @@
/*
* now translate it, bombing on any illegal binary digit
*/
- for (i = 0; inbuf[i] && i < 16; i++)
+ for (i = 0; i < 16 && inbuf[i]; i++)
if ((nbuf[i] = hex_to_binary((int) inbuf[i], 2)) == -1)
des_error("bad binary digit in key");
while (i < 64)
Home |
Main Index |
Thread Index |
Old Index