make variable initialization safer.

(IP6_EXTHDR_CHECK can call m_pullup under rare condition)
This commit is contained in:
itojun 2000-02-25 00:27:18 +00:00
parent c86b7572f9
commit 857bdcba78

View File

@ -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. * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -514,11 +515,9 @@ ah6_input(mp, offp, proto)
u_int16_t nxt; u_int16_t nxt;
int s; int s;
ip6 = mtod(m, struct ip6_hdr *);
#ifndef PULLDOWN_TEST #ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct ah), IPPROTO_DONE); IP6_EXTHDR_CHECK(m, off, sizeof(struct ah), IPPROTO_DONE);
ah = (struct ah *)(mtod(m, caddr_t) + off);
ah = (struct ah *)(((caddr_t)ip6) + off);
#else #else
IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah)); IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah));
if (ah == NULL) { if (ah == NULL) {
@ -527,7 +526,7 @@ ah6_input(mp, offp, proto)
return IPPROTO_DONE; return IPPROTO_DONE;
} }
#endif #endif
ip6 = mtod(m, struct ip6_hdr *);
nxt = ah->ah_nxt; nxt = ah->ah_nxt;
/* find the sassoc. */ /* find the sassoc. */