Source-Changes-HG archive

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

[src/trunk]: src/sys/netatalk Add sanity check, only sat_len bytes got copied...



details:   https://anonhg.NetBSD.org/src/rev/b72082cc3a53
branches:  trunk
changeset: 461530:b72082cc3a53
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Nov 29 17:40:16 2019 +0000

description:
Add sanity check, only sat_len bytes got copied in, the rest is
uninitialized. Found by KMSAN.

diffstat:

 sys/netatalk/ddp_usrreq.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 59b4e2a73e1f -r b72082cc3a53 sys/netatalk/ddp_usrreq.c
--- a/sys/netatalk/ddp_usrreq.c Fri Nov 29 17:33:43 2019 +0000
+++ b/sys/netatalk/ddp_usrreq.c Fri Nov 29 17:40:16 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_usrreq.c,v 1.73 2019/02/24 07:20:33 maxv Exp $      */
+/*     $NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $      */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.73 2019/02/24 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.74 2019/11/29 17:40:16 maxv Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_atalk.h"
@@ -97,6 +97,8 @@
 
                if (sat->sat_family != AF_APPLETALK)
                        return (EAFNOSUPPORT);
+               if (sat->sat_len != sizeof(*sat))
+                       return EINVAL;
 
                if (sat->sat_addr.s_node != ATADDR_ANYNODE ||
                    sat->sat_addr.s_net != ATADDR_ANYNET) {



Home | Main Index | Thread Index | Old Index