Module Name:    src
Committed By:   christos
Date:           Thu Sep 23 21:16:42 UTC 2010

Modified Files:
        src/sys/net: if.c

Log Message:
prevent integer oveflow. From Maksymilian Arciemowicz


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.244 src/sys/net/if.c:1.245
--- src/sys/net/if.c:1.244	Sat Jun 12 04:12:03 2010
+++ src/sys/net/if.c	Thu Sep 23 17:16:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.244 2010/06/12 08:12:03 skrll Exp $	*/
+/*	$NetBSD: if.c,v 1.245 2010/09/23 21:16:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.244 2010/06/12 08:12:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.245 2010/09/23 21:16:42 christos Exp $");
 
 #include "opt_inet.h"
 
@@ -981,7 +981,7 @@
 
 	unit = 0;
 	while (cp - name < IFNAMSIZ && *cp) {
-		if (*cp < '0' || *cp > '9' || unit > INT_MAX / 10) {
+		if (*cp < '0' || *cp > '9' || unit >= INT_MAX / 10) {
 			/* Bogus unit number. */
 			return NULL;
 		}

Reply via email to