Module Name:    src
Committed By:   christos
Date:           Mon Feb  1 17:41:37 UTC 2016

Modified Files:
        src/usr.bin/bdes: bdes.c

Log Message:
PR/50739: David Binderman: Check bounds before dereferencing.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/bdes/bdes.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/bdes/bdes.c
diff -u src/usr.bin/bdes/bdes.c:1.9 src/usr.bin/bdes/bdes.c:1.10
--- src/usr.bin/bdes/bdes.c:1.9	Thu Aug 15 16:48:56 2013
+++ src/usr.bin/bdes/bdes.c	Mon Feb  1 12:41:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdes.c,v 1.9 2013/08/15 20:48:56 joerg Exp $	*/
+/*	$NetBSD: bdes.c,v 1.10 2016/02/01 17:41:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)bdes.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: bdes.c,v 1.9 2013/08/15 20:48:56 joerg Exp $");
+__RCSID("$NetBSD: bdes.c,v 1.10 2016/02/01 17:41:37 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -425,7 +425,7 @@ cvtkey(char *obuf, char *ibuf)
 			/*
 			 * now translate it, bombing on any illegal hex digit
 			 */
-			for (i = 0; ibuf[i] && i < 16; i++)
+			for (i = 0; i < 16 && ibuf[i]; i++)
 				if ((nbuf[i] = tobinhex(ibuf[i], 16)) == -1)
 					bdes_err(-1, "bad hex digit in key");
 			while (i < 16)

Reply via email to