Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-1]: src/sys/compat/netbsd32 Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/599e919ff966
branches:  netbsd-6-1
changeset: 776084:599e919ff966
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Aug 02 12:52:59 2015 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1318):
        sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
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 24d2625705f8 -r 599e919ff966 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Fri Jul 24 07:36:51 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Sun Aug 02 12:52:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $     */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.64.14.1 2015/08/02 12:52:59 martin 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.64 2011/10/06 03:19:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.64.14.1 2015/08/02 12:52:59 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -192,7 +192,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
@@ -425,7 +425,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