diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-01-09 22:18:49 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-01-10 06:19:37 +0000 |
commit | 7cd6906056922e4b8f68f1216d94eaa0809896fe (patch) | |
tree | 5a8c793f188ddda7f36a50369d00ff0de8f563e5 /epan/dissectors/packet-ieee802154.c | |
parent | 2a3b2360e15d49defde55240a5c1e171c7cade89 (diff) |
Rename tvb_new_subset() to tvb_new_subset_length_caplen().
This emphasizes that there is no such thing as *the* routine to
construct a subset tvbuff; you need to choose one of
tvb_new_subset_remaining() (if you want a new tvbuff that contains
everything past a certain point in an existing tvbuff),
tvb_new_subset_length() (if you want a subset that contains everything
past a certain point, for some number of bytes, in an existing tvbuff),
and tvb_new_subset_length_caplen() (for all other cases).
Many of the calls to tvb_new_subset_length_caplen() should really be
calling one of the other routines; that's the next step. (This also
makes it easier to find the calls that need fixing.)
Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
Reviewed-on: https://code.wireshark.org/review/19597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-ieee802154.c')
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index 05a42ff284..3ef8189049 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -807,7 +807,7 @@ dissect_ieee802154_nonask_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } offset+=4+2*1; - mac=tvb_new_subset(tvb,offset,-1, phr & IEEE802154_PHY_LENGTH_MASK); + mac=tvb_new_subset_length_caplen(tvb,offset,-1, phr & IEEE802154_PHY_LENGTH_MASK); /* Call the common dissector. */ dissect_ieee802154(mac, pinfo, ieee802154_tree, NULL); @@ -862,7 +862,7 @@ dissect_ieee802154_nofcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo * checks to ensure that the new reported length is not longer than the old * reported length (why?), and will throw an exception. */ - new_tvb = tvb_new_subset(tvb, 0, -1, tvb_reported_length(tvb)+IEEE802154_FCS_LEN); + new_tvb = tvb_new_subset_length_caplen(tvb, 0, -1, tvb_reported_length(tvb)+IEEE802154_FCS_LEN); /* Call the common dissector. */ dissect_ieee802154_common(new_tvb, pinfo, tree, 0); return tvb_captured_length(tvb); @@ -906,7 +906,7 @@ dissect_zboss_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) proto_tree_add_item(zboss_tree, zboss_trace_number, tvb, off, 4, ENC_LITTLE_ENDIAN); off += 4; - return tvb_new_subset(tvb, off, tvb_captured_length(tvb) - off, tvb_captured_length(tvb) - off); + return tvb_new_subset_length_caplen(tvb, off, tvb_captured_length(tvb) - off, tvb_captured_length(tvb) - off); } } return tvb; @@ -1518,7 +1518,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g gint reported_len = tvb_reported_length(tvb)-offset-IEEE802154_FCS_LEN; gint captured_len = tvb_captured_length(tvb)-offset; if (reported_len < captured_len) captured_len = reported_len; - payload_tvb = tvb_new_subset(tvb, offset, captured_len, reported_len); + payload_tvb = tvb_new_subset_length_caplen(tvb, offset, captured_len, reported_len); } /* Display the reason for failure, and abort if the error was fatal. */ @@ -1573,7 +1573,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g gint reported_len = tvb_reported_length(tvb)-offset-IEEE802154_FCS_LEN; gint captured_len = tvb_captured_length(tvb)-offset; if (reported_len < captured_len) captured_len = reported_len; - payload_tvb = tvb_new_subset(tvb, offset, captured_len, reported_len); + payload_tvb = tvb_new_subset_length_caplen(tvb, offset, captured_len, reported_len); } /* presense of Payload IEs is defined by the termination of the Header IEs */ @@ -3060,7 +3060,7 @@ dissect_ieee802154_decrypt(tvbuff_t *tvb, guint offset, packet_info *pinfo, ieee } /* Create a tvbuff for the plaintext. This might result in a zero-length tvbuff. */ - ptext_tvb = tvb_new_subset(tvb, offset, captured_len, reported_len); + ptext_tvb = tvb_new_subset_length_caplen(tvb, offset, captured_len, reported_len); *status = DECRYPT_PACKET_SUCCEEDED; } |