diff --git a/packet-nbns.c b/packet-nbns.c index f37c082aee..f0e77fba22 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez * Much stuff added by Guy Harris * - * $Id: packet-nbns.c,v 1.17 1999/05/10 20:02:57 guy Exp $ + * $Id: packet-nbns.c,v 1.18 1999/05/10 21:50:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -981,7 +981,8 @@ struct nbdgm_header { }; void -dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) +dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, + int max_data) { proto_tree *nbdgm_tree; proto_item *ti; @@ -1073,6 +1074,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) header.src_port); offset += 10; + max_data -= 10; if (header.msg_type == 0x10 || header.msg_type == 0x11 || header.msg_type == 0x12) { @@ -1083,6 +1085,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) "Packet offset: %d bytes", header.pkt_offset); offset += 4; + max_data -= 4; /* Source name */ len = get_nbns_name(&pd[offset], pd, offset, name); @@ -1090,6 +1093,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(nbdgm_tree, offset, len, "Source name: %s", name); offset += len; + max_data -= len; /* Destination name */ len = get_nbns_name(&pd[offset], pd, offset, name); @@ -1097,9 +1101,10 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_item(nbdgm_tree, offset, len, "Destination name: %s", name); offset += len; + max_data -= len; /* here we can pass the packet off to the next protocol */ - dissect_data(pd, offset, fd, nbdgm_tree); + dissect_smb(pd, offset, fd, nbdgm_tree, max_data); } else if (header.msg_type == 0x13) { proto_tree_add_item(nbdgm_tree, offset, 1, "Error code: %s", diff --git a/packet-udp.c b/packet-udp.c index f58e966077..61839bf09c 100644 --- a/packet-udp.c +++ b/packet-udp.c @@ -1,7 +1,7 @@ /* packet-udp.c * Routines for UDP packet disassembly * - * $Id: packet-udp.c,v 1.14 1999/03/23 03:14:45 gram Exp $ + * $Id: packet-udp.c,v 1.15 1999/05/10 21:50:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -44,6 +44,8 @@ #include "packet.h" #include "resolv.h" +extern packet_info pi; + /* UDP structs and definitions */ typedef struct _e_udphdr { @@ -160,6 +162,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { struct hash_struct *dissect_routine = NULL; proto_tree *udp_tree; proto_item *ti; + guint payload; /* To do: Check for {cap len,pkt len} < struct len */ /* Avoids alignment problems on many architectures. */ @@ -169,6 +172,8 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { uh_ulen = ntohs(uh.uh_ulen); uh_sum = ntohs(uh.uh_sum); + payload = pi.payload - sizeof(e_udphdr); + if (check_col(fd, COL_PROTOCOL)) col_add_str(fd, COL_PROTOCOL, "UDP"); if (check_col(fd, COL_INFO)) @@ -214,7 +219,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { dissect_nbns(pd, offset, fd, tree); break; case UDP_PORT_NBDGM: - dissect_nbdgm(pd, offset, fd, tree); + dissect_nbdgm(pd, offset, fd, tree, payload); break; case UDP_PORT_IPX: /* RFC 1234 */ dissect_ipx(pd, offset, fd, tree); diff --git a/packet.h b/packet.h index 89e0d2c3b4..b6364735e7 100644 --- a/packet.h +++ b/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.52 1999/05/10 20:51:36 gram Exp $ + * $Id: packet.h,v 1.53 1999/05/10 21:50:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -362,7 +362,7 @@ void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *); void dissect_ipx(const u_char *, int, frame_data *, proto_tree *); void dissect_llc(const u_char *, int, frame_data *, proto_tree *); void dissect_lpd(const u_char *, int, frame_data *, proto_tree *); -void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *); +void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *, int); void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *, int); void dissect_nbns(const u_char *, int, frame_data *, proto_tree *); void dissect_ncp(const u_char *, int, frame_data *, proto_tree *, int);