aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-aim-generic.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2008-05-23 19:06:16 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2008-05-23 19:06:16 +0000
commit07f365a68d27620e661cec6bf0b1b2aa00156d8f (patch)
treef635138ef75372ce75f666be41552e0b448e54bc /epan/dissectors/packet-aim-generic.c
parent057522cbdc6a4cf2058866df4db792db35ca9f59 (diff)
From Alex Turbov:
Dissector for given SNAC has a bug with actual sizeof of rate_class and rate_group structure. So in UI clicking on 'Available Rate Classes' and concrete 'Rate Group 0x??' items in decoded packet window higlight incorrect bytes in hexdump window. svn path=/trunk/; revision=25374
Diffstat (limited to 'epan/dissectors/packet-aim-generic.c')
-rw-r--r--epan/dissectors/packet-aim-generic.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/epan/dissectors/packet-aim-generic.c b/epan/dissectors/packet-aim-generic.c
index f3c96ef88c..d0a1c92fb5 100644
--- a/epan/dissectors/packet-aim-generic.c
+++ b/epan/dissectors/packet-aim-generic.c
@@ -150,41 +150,40 @@ static gint ett_generic_rateinfo_classes = -1;
static gint ett_generic_rateinfo_groups = -1;
static gint ett_generic_rateinfo_group = -1;
-static int dissect_rate_class(tvbuff_t *tvb, packet_info *pinfo _U_, int offset,
- proto_tree *class_tree)
+static int dissect_rate_class(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *class_tree)
{
proto_tree_add_uint(class_tree, hf_generic_rateinfo_classid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));offset+=2;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_windowsize, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_clearlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_alertlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_limitlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_disconnectlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_currentlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_maxlevel, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
- proto_tree_add_uint(class_tree, hf_generic_rateinfo_lasttime, tvb, offset, 4, tvb_get_ntoh24(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_windowsize, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_clearlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_alertlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_limitlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_disconnectlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_currentlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_maxlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
+ proto_tree_add_uint(class_tree, hf_generic_rateinfo_lasttime, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
proto_tree_add_uint(class_tree, hf_generic_rateinfo_curstate, tvb, offset, 1, tvb_get_guint8(tvb, offset));offset+=1;
return offset;
}
-static int dissect_generic_rateinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
- proto_tree *tree)
+static int dissect_generic_rateinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
int offset = 0;
guint16 i;
proto_item *ti;
- guint16 numclasses = tvb_get_ntohs(tvb, 0);
+ guint16 numclasses = tvb_get_ntohs(tvb, 0);
proto_tree *classes_tree = NULL, *groups_tree, *group_tree;
proto_tree_add_uint(tree, hf_generic_rateinfo_numclasses, tvb, 0, 2, numclasses );
offset+=2;
if(tree) {
- ti = proto_tree_add_text(tree, tvb, offset, 33*numclasses, "Available Rate Classes");
+ /* sizeof(rate_class_struct) = 35 ! */
+ ti = proto_tree_add_text(tree, tvb, offset, 35 * numclasses, "Available Rate Classes");
classes_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_classes);
}
for(i = 0; i < numclasses; i++) {
- guint16 myid = tvb_get_ntohs(tvb, offset);
- proto_item *ti = proto_tree_add_text(classes_tree, tvb, offset, 33,"Rate Class 0x%02x", myid);
+ guint16 myid = tvb_get_ntohs(tvb, offset);
+ proto_item *ti = proto_tree_add_text(classes_tree, tvb, offset, 35, "Rate Class 0x%02x", myid);
proto_tree *class_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_class);
offset = dissect_rate_class(tvb, pinfo, offset, class_tree);
}
@@ -193,17 +192,19 @@ static int dissect_generic_rateinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
groups_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_groups);
for(i = 0; i < numclasses; i++) {
- guint16 myid = tvb_get_ntohs(tvb, offset);
guint16 j;
- guint16 numpairs;
-
- proto_item *ti = proto_tree_add_text(groups_tree, tvb, offset, 33,"Rate Group 0x%02x", myid);
+ guint16 myid = tvb_get_ntohs(tvb, offset);
+ guint16 numpairs = tvb_get_ntohs(tvb, offset + 2);
+ /*
+ * sizeof(rate_group) = sizeof(class_id) + sizeof(numpairs) + numpairs * 2 * sizeof(uint16_t)
+ * = 2 + 2 + numpairs * 4
+ */
+ proto_item *ti = proto_tree_add_text(groups_tree, tvb, offset, 4 + 4 * numpairs, "Rate Group 0x%02x", myid);
group_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_group);
proto_tree_add_uint(group_tree, hf_generic_rateinfo_classid, tvb, offset, 2, myid);offset+=2;
- numpairs = tvb_get_ntohs(tvb, offset);
proto_tree_add_uint(group_tree, hf_generic_rateinfo_numpairs, tvb, offset, 2, numpairs); offset+=2;
for(j = 0; j < numpairs; j++) {
- guint16 family_id;
+ guint16 family_id;
guint16 subtype_id;
const aim_family *family;
const aim_subtype *subtype;