aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-02-14 18:04:02 +0100
committerGuy Harris <guy@alum.mit.edu>2018-09-08 20:05:16 +0000
commitb37869599bc4faaa5e522b6fe4adbea5c3513fc6 (patch)
treee0491f814b2427061dc425c31f15324a0bb8679d
parentf783f4731dff9109c3e2b925a177da16ed6bacdc (diff)
downloadwireshark-b37869599bc4faaa5e522b6fe4adbea5c3513fc6.tar.gz
wireshark-b37869599bc4faaa5e522b6fe4adbea5c3513fc6.tar.bz2
wireshark-b37869599bc4faaa5e522b6fe4adbea5c3513fc6.zip
BT LE LL: fix invalid memory access reported by valgrind
- broadcast_addr shoudl be static and not on call stack - set the AT_STRINGZ address length with the string length and not the buffer length Bug: 13381 Change-Id: I86e15ccaa9b5d7779c266ab24b637476e983664c Reviewed-on: https://code.wireshark.org/review/20103 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> (cherry picked from commit fe78e1302f6076291e7270de2e8443ddb2c082af) Reviewed-on: https://code.wireshark.org/review/29496 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-btle.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 97a03d35c9..15e21120a6 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -316,7 +316,7 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
tvbuff_t *next_tvb;
guint8 *dst_bd_addr;
guint8 *src_bd_addr;
- const guint8 broadcast_addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ static const guint8 broadcast_addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
connection_address_t *connection_address = NULL;
wmem_tree_t *wmem_tree;
wmem_tree_key_t key[5];
@@ -695,11 +695,11 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
g_snprintf(str_addr, str_addr_len, "unknown_0x%08x", connection_address->access_address);
- set_address(&pinfo->net_src, AT_STRINGZ, str_addr_len, str_addr);
+ set_address(&pinfo->net_src, AT_STRINGZ, (int)strlen(str_addr)+1, str_addr);
copy_address_shallow(&pinfo->dl_src, &pinfo->net_src);
copy_address_shallow(&pinfo->src, &pinfo->net_src);
- set_address(&pinfo->net_dst, AT_STRINGZ, str_addr_len, str_addr);
+ set_address(&pinfo->net_dst, AT_STRINGZ, (int)strlen(str_addr)+1, str_addr);
copy_address_shallow(&pinfo->dl_dst, &pinfo->net_dst);
copy_address_shallow(&pinfo->dst, &pinfo->net_dst);