Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Wrong logic. Here, userland can control ...
details: https://anonhg.NetBSD.org/src/rev/c3c7486fd582
branches: trunk
changeset: 809789:c3c7486fd582
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Aug 02 07:37:57 2015 +0000
description:
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r c699a04272de -r c3c7486fd582 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 02 07:25:40 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Sun Aug 02 07:37:57 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.82 2015/08/02 07:37:57 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -144,7 +144,7 @@
strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name));
ifap->ifap_preference = ifap32->ifap_preference;
memcpy(&ifap->ifap_addr, &ifap32->ifap_addr,
- max(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
+ min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
}
static inline void
@@ -547,7 +547,7 @@
strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name));
ifap32->ifap_preference = ifap->ifap_preference;
memcpy(&ifap32->ifap_addr, &ifap->ifap_addr,
- max(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
+ min(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
}
static inline void
Home |
Main Index |
Thread Index |
Old Index