aboutsummaryrefslogtreecommitdiff
path: root/swaybar
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-07-14 07:38:41 -0400
committerGitHub <noreply@github.com>2017-07-14 07:38:41 -0400
commit5675a42def79ee8c2bbac32947034f1403aba4f6 (patch)
tree0fd4687209366697336ad541928e6b11dfe4bca2 /swaybar
parente33792e80a095b8619951e8c9c4fa0d16aa4c495 (diff)
parent5ceb52962e76b600396e356e31ec93edf8046475 (diff)
Merge pull request #1279 from 4e554c4c/bad_items
Fix name validation in sni_watcher.c
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/tray/sni_watcher.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/swaybar/tray/sni_watcher.c b/swaybar/tray/sni_watcher.c
index 388e181d..86453e70 100644
--- a/swaybar/tray/sni_watcher.c
+++ b/swaybar/tray/sni_watcher.c
@@ -150,10 +150,14 @@ static void register_item(DBusConnection *connection, DBusMessage *message) {
sway_log(L_ERROR, "Error parsing method args: %s\n", error.message);
}
- name = strdup(name);
sway_log(L_INFO, "RegisterStatusNotifierItem called with \"%s\"\n", name);
// Don't add duplicate or not real item
+ if (!dbus_validate_bus_name(name, NULL)) {
+ sway_log(L_INFO, "This item is not valid, we cannot keep track of it.");
+ return;
+ }
+
if (list_seq_find(items, (int (*)(const void *, const void *))strcmp, name) != -1) {
return;
}
@@ -161,7 +165,7 @@ static void register_item(DBusConnection *connection, DBusMessage *message) {
return;
}
- list_add(items, name);
+ list_add(items, strdup(name));
item_registered_signal(connection, name);
// It's silly, but xembedsniproxy wants a reply for this function
@@ -184,6 +188,12 @@ static void register_host(DBusConnection *connection, DBusMessage *message) {
sway_log(L_INFO, "RegisterStatusNotifierHost called with \"%s\"\n", name);
// Don't add duplicate or not real host
+ if (!dbus_validate_bus_name(name, NULL)) {
+ sway_log(L_INFO, "This item is not valid, we cannot keep track of it.");
+ return;
+ }
+
+
if (list_seq_find(hosts, (int (*)(const void *, const void *))strcmp, name) != -1) {
return;
}