From 0a9e84264947c75bbe96d0b67cb2dbe0f521f3b8 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sat, 20 Aug 2016 21:03:02 +0200 Subject: COAP: ensure that key_token is always initialized Even when the token length is 0. Bug: 12771 Change-Id: I0d77f0411fe90a6702d1f23ba9cd4b61433a5995 Reviewed-on: https://code.wireshark.org/review/17194 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-coap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'epan/dissectors/packet-coap.c') diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index f65691650e..663637046b 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -873,13 +873,13 @@ dissect_coap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d coap_uri_str_strbuf = wmem_strbuf_sized_new(wmem_packet_scope(), 0, 1024); coap_uri_query_strbuf = wmem_strbuf_sized_new(wmem_packet_scope(), 0, 1024); coap_token_str = NULL; + memset(&key_token[0], 0, sizeof(key_token)); if (token_len > 0) { coap_token_str = tvb_bytes_to_str_punct(wmem_packet_scope(), tvb, offset, token_len, ' '); proto_tree_add_item(coap_tree, hf_coap_token, tvb, offset, token_len, ENC_NA); - memset(&key_token[0], 0, sizeof(key_token)); if ( token_len > 8 ) { /* The token is limited to a maximum length of 8 but the bits in the * protocol specifies 4 bits. Use 8 bytes at most. */ -- cgit v1.2.1