* [PATCH] health: Fix not setting error
@ 2014-06-17 13:53 Andrei Emeltchenko
2014-06-17 18:55 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Emeltchenko @ 2014-06-17 13:53 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
When error is not set err->message may be accessed from the other code
resulting in NULL dereference.
---
android/mcap-lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/mcap-lib.c b/android/mcap-lib.c
index b04eaac..e0e1258 100644
--- a/android/mcap-lib.c
+++ b/android/mcap-lib.c
@@ -1932,6 +1932,8 @@ gboolean mcap_create_mcl(struct mcap_instance *mi,
}
mcap_mcl_unref(con->mcl);
g_free(con);
+ g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
+ "MCP connect failed");
return FALSE;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] health: Fix not setting error
2014-06-17 13:53 [PATCH] health: Fix not setting error Andrei Emeltchenko
@ 2014-06-17 18:55 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-06-17 18:55 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
On Tuesday 17 June 2014 16:53:01 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> When error is not set err->message may be accessed from the other code
> resulting in NULL dereference.
> ---
> android/mcap-lib.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/android/mcap-lib.c b/android/mcap-lib.c
> index b04eaac..e0e1258 100644
> --- a/android/mcap-lib.c
> +++ b/android/mcap-lib.c
> @@ -1932,6 +1932,8 @@ gboolean mcap_create_mcl(struct mcap_instance *mi,
> }
> mcap_mcl_unref(con->mcl);
> g_free(con);
> + g_set_error(err, MCAP_ERROR, MCAP_ERROR_FAILED,
> + "MCP connect failed");
> return FALSE;
> }
Wouldn't error be already set by bt_io_connect() in that case?
--
Szymon K. Janc
szymon.janc@gmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-17 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17 13:53 [PATCH] health: Fix not setting error Andrei Emeltchenko
2014-06-17 18:55 ` Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox