[gnome-bluetooth/wip/hadess/cleanups: 8/9] lib: Add guards to bluetooth_agent_register()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/cleanups: 8/9] lib: Add guards to bluetooth_agent_register()
- Date: Wed, 17 Feb 2021 16:32:19 +0000 (UTC)
commit edd3cfa5e19c2114b781631ce951e308271bd52e
Author: Bastien Nocera <hadess hadess net>
Date: Wed Feb 17 16:20:21 2021 +0100
lib: Add guards to bluetooth_agent_register()
This stops invalid agent object paths from being registered, and failing
deeper inside the library.
lib/bluetooth-agent.c | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/lib/bluetooth-agent.c b/lib/bluetooth-agent.c
index 6185a297..53aa8147 100644
--- a/lib/bluetooth-agent.c
+++ b/lib/bluetooth-agent.c
@@ -492,6 +492,8 @@ gboolean bluetooth_agent_register(BluetoothAgent *agent)
g_autoptr(GError) error = NULL;
g_return_val_if_fail (BLUETOOTH_IS_AGENT (agent), FALSE);
+ g_return_val_if_fail (agent->path != NULL, FALSE);
+ g_return_val_if_fail (g_variant_is_object_path(agent->path), FALSE);
agent->reg_id = g_dbus_connection_register_object (agent->conn,
agent->path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]