summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-01-30 15:24:18 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-01-31 14:10:56 +0200
commitb52543ae3df53f9cb82a2d7b1a6509f013daa8ac (patch)
tree463f149fa3c8a7ef654a7b8f1977020bb68eb7b6 /client
parentd5cb29ce5a3b5a50e2e1487a7de9d0ddd9bd61c5 (diff)
downloadbluez-b52543ae3df53f9cb82a2d7b1a6509f013daa8ac.tar.gz
client: Don't expose pointer value in attribute path
Instead use the position in the list to create a unique path: [bluetooth]# register-service 0x1820 [NEW] Primary Service (Handle 0x0000) /org/bluez/app/service0 0x1820 Internet Protocol Support
Diffstat (limited to 'client')
-rw-r--r--client/gatt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/client/gatt.c b/client/gatt.c
index 8e06e793f..06364a820 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -1449,7 +1449,8 @@ void gatt_register_service(DBusConnection *conn, GDBusProxy *proxy,
service = g_new0(struct service, 1);
service->conn = conn;
service->uuid = g_strdup(argv[1]);
- service->path = g_strdup_printf("%s/service%p", APP_PATH, service);
+ service->path = g_strdup_printf("%s/service%u", APP_PATH,
+ g_list_length(local_services));
service->primary = primary;
if (argc > 2)
@@ -2330,7 +2331,8 @@ void gatt_register_chrc(DBusConnection *conn, GDBusProxy *proxy,
chrc = g_new0(struct chrc, 1);
chrc->service = service;
chrc->uuid = g_strdup(argv[1]);
- chrc->path = g_strdup_printf("%s/chrc%p", service->path, chrc);
+ chrc->path = g_strdup_printf("%s/chrc%u", service->path,
+ g_list_length(service->chrcs));
chrc->flags = g_strsplit(argv[2], ",", -1);
chrc->authorization_req = attr_authorization_flag_exists(chrc->flags);
@@ -2600,7 +2602,8 @@ void gatt_register_desc(DBusConnection *conn, GDBusProxy *proxy,
desc = g_new0(struct desc, 1);
desc->chrc = g_list_last(service->chrcs)->data;
desc->uuid = g_strdup(argv[1]);
- desc->path = g_strdup_printf("%s/desc%p", desc->chrc->path, desc);
+ desc->path = g_strdup_printf("%s/desc%u", desc->chrc->path,
+ g_list_length(desc->chrc->descs));
desc->flags = g_strsplit(argv[2], ",", -1);
if (argc > 3)