]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/route6.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / bsd / netinet6 / route6.c
index cc0886d44464222ddd3180855aa055f858db553a..0a3d9b1ceb33715785d80d43e0e3251dd7f57dff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2020 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -77,22 +77,24 @@ int
 route6_input(struct mbuf **mp, int *offp, int proto)
 {
 #pragma unused(proto)
-       struct ip6_hdr *ip6;
+       struct ip6_hdr *ip6 = NULL;
        struct mbuf *m = *mp;
-       struct ip6_rthdr *rh;
-       int off = *offp, rhlen;
+       struct ip6_rthdr *rh = NULL;
+       int off = *offp, rhlen = 0;
 #ifdef notyet
-       struct ip6aux *ip6a;
+       struct ip6aux *ip6a = NULL;
 
        ip6a = ip6_findaux(m);
        if (ip6a) {
                /* XXX reject home-address option before rthdr */
                if (ip6a->ip6a_flags & IP6A_SWAP) {
                        ip6stat.ip6s_badoptions++;
+                       *mp = NULL;
                        m_freem(m);
                        return IPPROTO_DONE;
                }
        }
+       ip6a = NULL;
 #endif /* notyet */
 
        IP6_EXTHDR_CHECK(m, off, sizeof(*rh), return IPPROTO_DONE);
@@ -112,10 +114,11 @@ route6_input(struct mbuf **mp, int *offp, int proto)
                }
                ip6stat.ip6s_badoptions++;
                icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
-                   (caddr_t)&rh->ip6r_type - (caddr_t)ip6);
+                   (int)((caddr_t)&rh->ip6r_type - (caddr_t)ip6));
                return IPPROTO_DONE;
        }
 
+       *mp = m;
        *offp += rhlen;
        return rh->ip6r_nxt;
 }