summaryrefslogtreecommitdiff
path: root/sys/compat/linux/common/linux_socket.c
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>2012-03-15 16:17:48 +0000
committerbouyer <bouyer@NetBSD.org>2012-03-15 16:17:48 +0000
commit267cf1b4c594ff5df4060282b4bb881d70e0a5a5 (patch)
tree5687eb71cbd94b9e3313061ac46edbf357e1c19e /sys/compat/linux/common/linux_socket.c
parent672b0d02c3b6d92a74678ec6e4405b941232fc36 (diff)
Do not read past end of array. Found by gcc -03
Diffstat (limited to 'sys/compat/linux/common/linux_socket.c')
-rw-r--r--sys/compat/linux/common/linux_socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c
index 66220be7d37..edc1da8070e 100644
--- a/sys/compat/linux/common/linux_socket.c
+++ b/sys/compat/linux/common/linux_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.112 2012/01/20 14:08:07 joerg Exp $ */
+/* $NetBSD: linux_socket.c,v 1.113 2012/03/15 16:17:48 bouyer Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.112 2012/01/20 14:08:07 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.113 2012/03/15 16:17:48 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1203,7 +1203,7 @@ linux_getifhwaddr(struct lwp *l, register_t *retval, u_int fd,
if (strncmp(lreq.ifr_name, "eth", 3) == 0) {
for (ifnum = 0, index = 3;
- lreq.ifr_name[index] != '\0' && index < LINUX_IFNAMSIZ;
+ index < LINUX_IFNAMSIZ && lreq.ifr_name[index] != '\0';
index++) {
ifnum *= 10;
ifnum += lreq.ifr_name[index] - '0';