diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-24 07:55:03 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-24 07:55:03 +0000 |
commit | 2fa2515f77a0604586612234ebf3e6f89759bf4a (patch) | |
tree | bfd24a804323592bae4e408fdaf31e7fcd928839 | |
parent | c86c9ed70992aacb3767522195b847de2d7bf008 (diff) | |
download | wireshark-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
-rw-r--r-- | epan/dissectors/packet-atalk.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-dsi.c | 21 |
2 files changed, 22 insertions, 11 deletions
diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index e6885745c4..26f63331fd 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -1055,8 +1055,9 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * if (machine_ofs) proto_tree_add_item(tree, hf_asp_server_type, tvb, machine_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: %u", nbe); ofs++; @@ -1068,8 +1069,9 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } } - 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: %u", nbe); ofs++; @@ -1081,9 +1083,11 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } } - 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_asp_server_icon, tvb, ofs, 256, ENC_NA); + } if (sign_ofs) { proto_tree_add_item(tree, hf_asp_server_signature, tvb, sign_ofs, 16, ENC_NA); 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); |