aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Cragie <robert.cragie@gmail.com>2019-08-01 14:23:57 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-08-12 20:23:42 +0000
commitb22030f7124bb48e80acc1ab93a1d9449c50a2df (patch)
tree1e39e1da7c574e05694ec6e2c739481b657e21a7
parent1239e1fd34d28a9aa1eb3c04772215b6c7059e42 (diff)
Thread: Fix URI token passing to CoAP dissector
Incorrect token index being passed to Thread CoAP dissector. Change-Id: Ic64060134c655a5e7cfdee0cd0b78b98b60f090e Reviewed-on: https://code.wireshark.org/review/34154 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--epan/dissectors/packet-thread.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/epan/dissectors/packet-thread.c b/epan/dissectors/packet-thread.c
index 533eb2f2cd..86cc9d600f 100644
--- a/epan/dissectors/packet-thread.c
+++ b/epan/dissectors/packet-thread.c
@@ -401,6 +401,8 @@ static dissector_handle_t thread_address_handle;
#define THREAD_TLV_LENGTH_ESC 0xFF
+#define THREAD_URI_NAMESPACE_IDX 1
+
#define THREAD_MC_32768_TO_NSEC_FACTOR ((double)30517.578125)
#define THREAD_MC_TSTAMP_MASK_U_MASK 0x80
#define THREAD_MC_SEC_POLICY_MASK_O_MASK 0x80
@@ -2107,9 +2109,9 @@ dissect_thread_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
uri = wmem_strbuf_get_str(coinfo->uri_str_strbuf);
tokens = wmem_strsplit(wmem_packet_scope(), uri, "/", 3);
- if ((tokens[0] != NULL) && (tokens[1] != NULL)) {
- /* No need to create a subset as we are dissecting the tvb as it is */
- dissector_try_string(thread_coap_namespace, tokens[0], tvb, pinfo, tree, NULL);
+ if (g_strv_length(tokens) == 3) {
+ /* No need to create a subset as we are dissecting the tvb as it is. */
+ dissector_try_string(thread_coap_namespace, tokens[THREAD_URI_NAMESPACE_IDX], tvb, pinfo, tree, NULL);
}
return tvb_captured_length(tvb);