summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'binding/bluetooth-util.c')
-rw-r--r--binding/bluetooth-util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/binding/bluetooth-util.c b/binding/bluetooth-util.c
index 21aae6c..4740cda 100644
--- a/binding/bluetooth-util.c
+++ b/binding/bluetooth-util.c
@@ -1039,7 +1039,7 @@ void json_process_path(json_object *jresp, const char *path) {
gchar *return_bluez_path(afb_req_t request) {
const char *adapter = afb_req_value(request, "adapter");
- const char *device;
+ const char *device, *tmp;
adapter = adapter ? adapter : BLUEZ_DEFAULT_ADAPTER;
@@ -1049,6 +1049,16 @@ gchar *return_bluez_path(afb_req_t request) {
return NULL;
}
+ tmp = device;
+
+ /* Stop the dbus call from segfaulting from special characters */
+ for (; *tmp; tmp++) {
+ if (!g_ascii_isalnum(*tmp) && *tmp != '_') {
+ afb_req_fail(request, "failed", "Invalid device parameter");
+ return NULL;
+ }
+ }
+
return g_strconcat("/org/bluez/", adapter, "/", device, NULL);
}