summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dsi.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-24 07:55:03 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-24 07:55:03 +0000
commit2fa2515f77a0604586612234ebf3e6f89759bf4a (patch)
treebfd24a804323592bae4e408fdaf31e7fcd928839 /epan/dissectors/packet-dsi.c
parentc86c9ed70992aacb3767522195b847de2d7bf008 (diff)
downloadwireshark-2fa2515f77a0604586612234ebf3e6f89759bf4a.tar.gz
Check for a zero offset in the "get status" reply *before* adding the
offset in the tvbuff of the beginning of the packet to it. Otherwise, it will never be zero, and the tests will always think the field pointed to by the offset is present. svn path=/trunk/; revision=54938
Diffstat (limited to 'epan/dissectors/packet-dsi.c')
-rw-r--r--epan/dissectors/packet-dsi.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c
index 1c8c6b386c..124cb75ff6 100644
--- a/epan/dissectors/packet-dsi.c
+++ b/epan/dissectors/packet-dsi.c
@@ -344,7 +344,8 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
sign_ofs = tvb_get_ntohs(tvb, ofs);
proto_tree_add_text(tree, tvb, ofs, 2, "Signature offset: %d", sign_ofs);
- sign_ofs += offset;
+ if (sign_ofs)
+ sign_ofs += offset;
if ((flag & AFPSRVRINFO_TCPIP)) {
ofs += 2;
@@ -367,12 +368,15 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
}
}
- ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
- if (ofs)
+ ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
+ if (ofs) {
+ ofs += offset;
proto_tree_add_item(tree, hf_dsi_server_type, tvb, ofs, 1, ENC_ASCII|ENC_NA);
+ }
- ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
+ ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
if (ofs) {
+ ofs += offset;
nbe = tvb_get_guint8(tvb, ofs);
ti = proto_tree_add_text(tree, tvb, ofs, 1, "Version list: %d", nbe);
ofs++;
@@ -384,8 +388,9 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
}
}
- ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
+ ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
if (ofs) {
+ ofs += offset;
nbe = tvb_get_guint8(tvb, ofs);
ti = proto_tree_add_text(tree, tvb, ofs, 1, "UAMS list: %d", nbe);
ofs++;
@@ -397,9 +402,11 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
}
}
- ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
- if (ofs)
+ ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
+ if (ofs) {
+ ofs += offset;
proto_tree_add_item(tree, hf_dsi_server_icon, tvb, ofs, 256, ENC_NA);
+ }
if (sign_ofs) {
proto_tree_add_item(tree, hf_dsi_server_signature, tvb, sign_ofs, 16, ENC_NA);