diff options
author | Michael Mann <mmann78@netscape.net> | 2014-10-19 00:29:35 -0400 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-10-19 15:26:43 +0000 |
commit | 5e4e17ca5e0d5910aad8d6e9fc8b23d9a68b756e (patch) | |
tree | 1173fb48a2db0e444b9a75ad1741ea8eda523cd3 /epan/dissectors/packet-mmse.c | |
parent | 1427a8e9865d5bc1786499c0530ed56edb3fdebe (diff) |
Remove unnecessary tvb_ensure_bytes_exist calls.
All of the calls removed are followed by proto_tree_add_xxx calls of the same offset/length of the tvb_ensure_bytes_exist call. The proto_tree_add_xxx calls should throw the exception, so we don't need the "double check".
There are probably more calls that can be removed, these were just obvious as first glance, spurred mostly by noticing the (ab)use in packet-wsp.c
Change-Id: I37cee347c8cf8ab0559e21562c802d3b37f4871e
Reviewed-on: https://code.wireshark.org/review/4833
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mmse.c')
-rw-r--r-- | epan/dissectors/packet-mmse.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index 6d80907f66..896eeeb527 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -803,13 +803,10 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, } else { length += 1; } - if (tree) { - tvb_ensure_bytes_exist(tvb, offset - 1, length + 1); - proto_tree_add_string(mmse_tree, + proto_tree_add_string(mmse_tree, hf_mmse_content_location, tvb, offset - 1, length + 1, "<Undecoded value for m-mbox-delete-conf>"); - } } else { length = get_text_string(tvb, offset, &strval); if (tree) { @@ -828,11 +825,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tval = get_long_integer(tvb, offset, &count); tmptime.secs = tval; tmptime.nsecs = 0; - if (tree) { - tvb_ensure_bytes_exist(tvb, offset - 1, count + 1); - proto_tree_add_time(mmse_tree, hf_mmse_date, tvb, + proto_tree_add_time(mmse_tree, hf_mmse_date, tvb, offset - 1, count + 1, &tmptime); - } } offset += count; break; @@ -860,7 +854,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_delivery_time_abs, @@ -890,7 +883,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_expiry_abs, tvb, offset - 1, @@ -910,7 +902,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, length = get_value_length(tvb, offset, &count); if (tree) { field = tvb_get_guint8(tvb, offset + count); - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x81) { proto_tree_add_string(mmse_tree, hf_mmse_from, tvb, offset-1, length + count + 1, @@ -1124,7 +1115,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, tmptime.secs = tval; tmptime.nsecs = 0; - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); if (field == 0x80) proto_tree_add_time(mmse_tree, hf_mmse_reply_charging_deadline_abs, tvb, offset - 1, @@ -1205,7 +1195,6 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, strval = abs_time_to_str(wmem_packet_scope(), &tmptime, ABSOLUTE_TIME_LOCAL, TRUE); /* Now render the fields */ - tvb_ensure_bytes_exist(tvb, offset - 1, length + count + 1); tii = proto_tree_add_string_format(mmse_tree, hf_mmse_prev_sent_date, tvb, offset - 1, 1 + count + length, |