From a750cab655515904022c6a62651a855077a49315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Mon, 12 Oct 2020 10:08:18 +0200 Subject: [PATCH] thread: Add check for valid CoAP info Add a check for valid CoAP info in dissect_thread_coap() before use. It may happen that this is NULL because setting a decode_as rule for application/octet-stream will also catch other packets. --- epan/dissectors/packet-thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epan/dissectors/packet-thread.c b/epan/dissectors/packet-thread.c index 49cd9a6f06..588ac2f9cb 100644 --- a/epan/dissectors/packet-thread.c +++ b/epan/dissectors/packet-thread.c @@ -2105,6 +2105,10 @@ dissect_thread_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d /* Obtain the CoAP info */ coinfo = (coap_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_coap, 0); + + /* Reject the packet if not CoAP */ + if (!coinfo) return 0; + uri = wmem_strbuf_get_str(coinfo->uri_str_strbuf); tokens = wmem_strsplit(wmem_packet_scope(), uri, "/", 3);