diff options
author | Anders Broman <anders.broman@ericsson.com> | 2013-06-11 05:27:47 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2013-06-11 05:27:47 +0000 |
commit | a9933bf603fefe10dc8ffd65cdf055f4886e9840 (patch) | |
tree | 809c50fe6afd93f8f1a1ae96f3ebcdbc9a4fc1c7 /epan/dissectors/packet-coap.c | |
parent | ae868938aaf6cf6b196e9dd4e6719e8e4fdd0208 (diff) |
From Hauke Mehrtens:
There is no option length attribute any more there is just the end of
options marker.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8780
svn path=/trunk/; revision=49881
Diffstat (limited to 'epan/dissectors/packet-coap.c')
-rw-r--r-- | epan/dissectors/packet-coap.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 2f9679665a..a75746ef1d 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -6,6 +6,9 @@ * draft-ietf-core-link-format-06.txt * Shoichi Sakane <sakane@tanu.org> * + * Changes for draft-ietf-core-coap-17.txt + * Hauke Mehrtens <hauke@hauke-m.de> + * * $Id$ * * Wireshark - Network traffic analyzer @@ -777,17 +780,25 @@ dissect_coap_options_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tr * or the end of the data. */ static int -dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, gint offset, gint coap_length, guint8 opt_count) +dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, gint offset, gint coap_length) { guint opt_num = 0; int i; + guint8 endmarker; /* loop for dissecting options */ - for (i = 1; i <= opt_count; i++) { + for (i = 1; offset < coap_length; i++) { offset = dissect_coap_options_main(tvb, pinfo, coap_tree, offset, i, &opt_num, coap_length); if (offset == -1) return -1; + if (offset >= coap_length) + break; + endmarker = tvb_get_guint8(tvb, offset); + if (endmarker == 0xff) { + offset++; + break; + } } return offset; @@ -854,7 +865,7 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } /* process options */ - offset = dissect_coap_options(tvb, pinfo, coap_tree, offset, coap_length, 0); + offset = dissect_coap_options(tvb, pinfo, coap_tree, offset, coap_length); if (offset == -1) return; |