Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 make sure not to overwrite sockaddr on PRU_SEND...



details:   https://anonhg.NetBSD.org/src/rev/681479981c6d
branches:  trunk
changeset: 487484:681479981c6d
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Jun 08 13:51:33 2000 +0000

description:
make sure not to overwrite sockaddr on PRU_SEND/PRU_CONNECT to
link-local address.  From: frank

diffstat:

 sys/netinet6/in6_pcb.c     |  7 ++++++-
 sys/netinet6/udp6_usrreq.c |  7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (56 lines):

diff -r d8c7d00a6316 -r 681479981c6d sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Thu Jun 08 13:30:39 2000 +0000
+++ b/sys/netinet6/in6_pcb.c    Thu Jun 08 13:51:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_pcb.c,v 1.25 2000/06/05 08:09:48 itojun Exp $      */
+/*     $NetBSD: in6_pcb.c,v 1.26 2000/06/08 13:51:33 itojun Exp $      */
 /*     $KAME: in6_pcb.c,v 1.45 2000/06/05 00:41:58 itojun Exp $        */
 
 /*
@@ -307,6 +307,7 @@
        struct ifnet *ifp = NULL;       /* outgoing interface */
        int error = 0;
        struct in6_addr mapped;
+       struct sockaddr_in6 tmp;
 
        (void)&in6a;                            /* XXX fool gcc */
 
@@ -328,6 +329,10 @@
                        return EINVAL;
        }
 
+       /* protect *sin6 from overwrites */
+       tmp = *sin6;
+       sin6 = &tmp;
+
        /*
         * If the scope of the destination is link-local, embed the interface
         * index in the address.
diff -r d8c7d00a6316 -r 681479981c6d sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c        Thu Jun 08 13:30:39 2000 +0000
+++ b/sys/netinet6/udp6_usrreq.c        Thu Jun 08 13:51:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udp6_usrreq.c,v 1.29 2000/06/05 06:38:23 itojun Exp $  */
+/*     $NetBSD: udp6_usrreq.c,v 1.30 2000/06/08 13:51:34 itojun Exp $  */
 /*     $KAME: udp6_usrreq.c,v 1.52 2000/06/05 00:41:58 itojun Exp $    */
 
 /*
@@ -566,6 +566,7 @@
 #ifdef INET
        struct ip *ip;
 #endif
+       struct sockaddr_in6 tmp;
 
        priv = 0;
        if (p && !suser(p->p_ucred, &p->p_acflag))
@@ -605,6 +606,10 @@
                        goto release;
                }
 
+               /* protect *sin6 from overwrites */
+               tmp = *sin6;
+               sin6 = &tmp;
+
                faddr = &sin6->sin6_addr;
                fport = sin6->sin6_port; /* allow 0 port */
                /*



Home | Main Index | Thread Index | Old Index