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>
This commit is contained in:
Robert Cragie 2019-08-01 14:23:57 +01:00 committed by Peter Wu
parent 1239e1fd34
commit b22030f712
1 changed files with 5 additions and 3 deletions

View File

@ -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);