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

Modified Files:
        src/sys/arch/evbmips/gdium: machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbmips/gdium/machdep.c

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

Modified files:

Index: src/sys/arch/evbmips/gdium/machdep.c
diff -u src/sys/arch/evbmips/gdium/machdep.c:1.17 src/sys/arch/evbmips/gdium/machdep.c:1.18
--- src/sys/arch/evbmips/gdium/machdep.c:1.17	Mon Mar 24 16:06:31 2014
+++ src/sys/arch/evbmips/gdium/machdep.c	Mon Feb  1 12:37:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.17 2014/03/24 20:06:31 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.18 2016/02/01 17:37:39 christos Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2014/03/24 20:06:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.18 2016/02/01 17:37:39 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -221,7 +221,7 @@ mach_init(int argc, char **argv, char **
 	 * #ifdef orgy
 	 */
 	i = 0;
-	while ((eptrs[i] != 0) && (i < 128)) {
+	while (i < 128 && eptrs[i] != 0) {
 		envp[i] = (char *)(intptr_t)eptrs[i];	/* sign extend */
 		i++;
 	}

Reply via email to