2012-02-10 21:47:52

by Vinicius Costa Gomes

[permalink] [raw]
Subject: [PATCH BlueZ] adapter: Fix possible invalid memory access

---

This possible crash was detected by the clang static analysis tool.

src/adapter.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 60477bb..36073ff 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1906,8 +1906,10 @@ static void create_stored_device_from_ltks(char *key, char *value,
bdaddr_t src;

info = get_ltk_info(key, value);
- if (info)
- keys->keys = g_slist_append(keys->keys, info);
+ if (info == NULL)
+ return;
+
+ keys->keys = g_slist_append(keys->keys, info);

if (g_slist_find_custom(adapter->devices, key,
(GCompareFunc) device_address_cmp))
--
1.7.8.1



2012-02-14 12:46:09

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] adapter: Fix possible invalid memory access

Hi Vinicius,

On Fri, Feb 10, 2012, Vinicius Costa Gomes wrote:
> ---
>
> This possible crash was detected by the clang static analysis tool.
>
> src/adapter.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan