From bbf70e7f690f0735294bc5fc986eec31cf2f501b Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 Jun 2011 19:46:46 +0000 Subject: [PATCH] Fix printing of UDP and SCTP IPv6 packets. Unlike other protocols, these assumed an IP header length of sizeof(struct ip). --- libnetutil/netutil.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 84e1d50c9..2c1688c71 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -2398,7 +2398,7 @@ if (hdr.version == 4) { /* IPv4 */ } else if (hdr.proto == IPPROTO_UDP && frag_off) { Snprintf(protoinfo, sizeof(protoinfo), "UDP %s:?? > %s:?? fragment %s (incomplete)", srchost, dsthost, ipinfo); } else if (hdr.proto == IPPROTO_UDP) { - udp = (struct udp_hdr *) (packet + sizeof(struct ip)); + udp = (struct udp_hdr *) data; /* TODO: See if we can segfault if we receive a fragmented packet whose IP packet does not say a thing about fragmentation */ @@ -2422,7 +2422,7 @@ if (hdr.version == 4) { /* IPv4 */ } else if (hdr.proto == IPPROTO_SCTP && frag_off) { Snprintf(protoinfo, sizeof(protoinfo), "SCTP %s:?? > %s:?? fragment %s (incomplete)", srchost, dsthost, ipinfo); } else if (hdr.proto == IPPROTO_SCTP) { - sctp = (struct sctp_hdr *) (packet + sizeof(struct ip)); + sctp = (struct sctp_hdr *) data; if( detail == LOW_DETAIL ){ Snprintf(protoinfo, sizeof(protoinfo), "SCTP %s:%d > %s:%d %s",