Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux/common Hum, remove incorrect assignment. Us...



details:   https://anonhg.NetBSD.org/src/rev/ba75c72c8329
branches:  trunk
changeset: 1003290:ba75c72c8329
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Sep 08 18:46:32 2019 +0000

description:
Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.

diffstat:

 sys/compat/linux/common/linux_socket.c |  7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r a84202755b0e -r ba75c72c8329 sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c    Sun Sep 08 17:47:33 2019 +0000
+++ b/sys/compat/linux/common/linux_socket.c    Sun Sep 08 18:46:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_socket.c,v 1.148 2019/08/24 14:18:43 maxv Exp $  */
+/*     $NetBSD: linux_socket.c,v 1.149 2019/09/08 18:46:32 maxv 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.148 2019/08/24 14:18:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.149 2019/09/08 18:46:32 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1609,9 +1609,6 @@
                sin6->sin6_scope_id = 0;
        }
 
-       if (bdom == AF_INET)
-               namelen = sizeof(struct sockaddr_in);
-
        sb->sb_family = bdom;
        sb->sb_len = namelen;
        ktrkuser("mbsoname", sb, namelen);



Home | Main Index | Thread Index | Old Index