summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-coap.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-08-20 21:03:02 +0200
committerAnders Broman <a.broman58@gmail.com>2016-08-20 22:24:14 +0000
commit0a9e84264947c75bbe96d0b67cb2dbe0f521f3b8 (patch)
tree196a0b6dfdadf65d71cac060fffd44632f9089db /epan/dissectors/packet-coap.c
parent8f98f7ce67d23fbeb17a4a3fd75cb376a705300f (diff)
downloadwireshark-0a9e84264947c75bbe96d0b67cb2dbe0f521f3b8.tar.gz
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 <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-coap.c')
-rw-r--r--epan/dissectors/packet-coap.c2
1 files changed, 1 insertions, 1 deletions
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. */