Module Name:    src
Committed By:   martin
Date:           Mon Jul 31 16:14:52 UTC 2023

Modified Files:
        src/sys/netatalk [netbsd-9]: at_control.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1684):

        sys/netatalk/at_control.c: revision 1.44

atalk(4): Don't let userland control sa_len when adding addresses.
- The struct sockaddr_at object accessed by at_ifinit always comes
  from an ioctl buffer that is adequately sized and fully initialized
  from userland memory.
- The newly created sockaddr_at object is later used with
  sockaddr_copy, which requires sa_len to be correctly initialized.
- sa_len is not generally required to be correctly initialized by
  userland in most entry points (with some exceptions, e.g. gif(4)
  configuration).

I don't know whether existing userland programs initialize sa_len
correctly; if they do, we can verify it matches sizeof(struct
sockaddr_at), but there's no need to copy sa_len then if it is
verified to be that fixed value.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.8.1 src/sys/netatalk/at_control.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netatalk/at_control.c
diff -u src/sys/netatalk/at_control.c:1.40 src/sys/netatalk/at_control.c:1.40.8.1
--- src/sys/netatalk/at_control.c:1.40	Sat Feb 17 19:10:18 2018
+++ src/sys/netatalk/at_control.c	Mon Jul 31 16:14:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_control.c,v 1.40 2018/02/17 19:10:18 rjs Exp $	 */
+/*	$NetBSD: at_control.c,v 1.40.8.1 2023/07/31 16:14:51 martin Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.40 2018/02/17 19:10:18 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.40.8.1 2023/07/31 16:14:51 martin Exp $");
 
 #include "opt_atalk.h"
 
@@ -421,7 +421,7 @@ at_ifinit(struct ifnet *ifp, struct at_i
          * that phase 1 probes use only nodes, not net.node pairs.  Under
          * phase 2, both the net and node must be the same.
          */
-	AA_SAT(aa)->sat_len = sat->sat_len;
+	AA_SAT(aa)->sat_len = sizeof(struct sockaddr_at);
 	AA_SAT(aa)->sat_family = AF_APPLETALK;
 	if (ifp->if_flags & IFF_LOOPBACK) {
 		AA_SAT(aa)->sat_addr.s_net = sat->sat_addr.s_net;

Reply via email to