From e33adb1b380cda2bb7d8a7b2b9d0b02c48aa5b12 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 7 Dec 2003 02:42:54 +0000 Subject: Only check the destination address if it's AT_ETHER; otherwise, there's no guarantee that "data[5]" exists or can be interpreted in that fashion. svn path=/trunk/; revision=9188 --- packet-nt-sonmp.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'packet-nt-sonmp.c') diff --git a/packet-nt-sonmp.c b/packet-nt-sonmp.c index 243b758626..df3077476f 100644 --- a/packet-nt-sonmp.c +++ b/packet-nt-sonmp.c @@ -2,7 +2,7 @@ * Routines for the disassembly of the "Nortel Networks / SynOptics Network Management Protocol" * (c) Copyright Giles Scott * -* $Id: packet-nt-sonmp.c,v 1.3 2003/12/06 19:26:04 oabad Exp $ +* $Id: packet-nt-sonmp.c,v 1.4 2003/12/07 02:42:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -207,6 +207,7 @@ static gint ett_sonmp = -1; static void dissect_sonmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { + char *hello_type; guint32 sonmp_ip_address; guint32 sonmp_segment_identifier = 0; /* actually 3 bytes not 4 */ guint8 sonmp_chassis_type; @@ -220,11 +221,24 @@ dissect_sonmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "SONMP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_fstr(pinfo->cinfo, COL_INFO, "SONMP - %s Hello", - pinfo->dl_dst.data == NULL ? "" : - pinfo->dl_dst.data[5] == 0 ? "Segment" : - pinfo->dl_dst.data[5] == 1 ? "FlatNet" : ""); + if (check_col(pinfo->cinfo, COL_INFO)) { + hello_type = ""; + if (pinfo->dl_dst.type == AT_ETHER) { + + switch (pinfo->dl_dst.data[5]) { + + case 0: + hello_type = "Segment "; + break; + + case 1: + hello_type = "FlatNet "; + break; + } + } + col_add_fstr(pinfo->cinfo, COL_INFO, "SONMP - %sHello", + hello_type); + } if (tree) { ti = proto_tree_add_protocol_format(tree, proto_sonmp, tvb, 0, 11, -- cgit v1.2.3