Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 make variable initialization safer.



details:   https://anonhg.NetBSD.org/src/rev/01cff971dd20
branches:  trunk
changeset: 482896:01cff971dd20
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Feb 25 00:27:18 2000 +0000

description:
make variable initialization safer.
(IP6_EXTHDR_CHECK can call m_pullup under rare condition)

diffstat:

 sys/netinet6/ah_input.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 0a51f64eec70 -r 01cff971dd20 sys/netinet6/ah_input.c
--- a/sys/netinet6/ah_input.c   Fri Feb 25 00:23:57 2000 +0000
+++ b/sys/netinet6/ah_input.c   Fri Feb 25 00:27:18 2000 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: ah_input.c,v 1.9 2000/02/17 10:59:38 darrenr Exp $     */
+/*     $NetBSD: ah_input.c,v 1.10 2000/02/25 00:27:18 itojun Exp $     */
+/*     $KAME: ah_input.c,v 1.20 2000/02/24 12:02:09 itojun Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -514,11 +515,9 @@
        u_int16_t nxt;
        int s;
 
-       ip6 = mtod(m, struct ip6_hdr *);
 #ifndef PULLDOWN_TEST
        IP6_EXTHDR_CHECK(m, off, sizeof(struct ah), IPPROTO_DONE);
-
-       ah = (struct ah *)(((caddr_t)ip6) + off);
+       ah = (struct ah *)(mtod(m, caddr_t) + off);
 #else
        IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah));
        if (ah == NULL) {
@@ -527,7 +526,7 @@
                return IPPROTO_DONE;
        }
 #endif
-
+       ip6 = mtod(m, struct ip6_hdr *);
        nxt = ah->ah_nxt;
 
        /* find the sassoc.  */



Home | Main Index | Thread Index | Old Index