summaryrefslogtreecommitdiffstats
path: root/swaybar/tray/tray.c
diff options
context:
space:
mode:
authorLibravatar Calvin Lee <cyrus296@gmail.com>2017-07-13 07:47:21 -0700
committerLibravatar Calvin Lee <cyrus296@gmail.com>2017-07-13 07:47:21 -0700
commit62223e8fbbccac5581da1464081662b44f8a6e03 (patch)
tree3ed23fe4384bbc81e2bd9da71a28264aec0742fd /swaybar/tray/tray.c
parentMerge pull request #1272 from ascent12/pointer-fix (diff)
downloadsway-62223e8fbbccac5581da1464081662b44f8a6e03.tar.gz
sway-62223e8fbbccac5581da1464081662b44f8a6e03.tar.zst
sway-62223e8fbbccac5581da1464081662b44f8a6e03.zip
Don't trust SNI names, fixes #1274
If an item doesn't have a well-formed name, it will not be added to the tray.
Diffstat (limited to 'swaybar/tray/tray.c')
-rw-r--r--swaybar/tray/tray.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index 7634942a..c1d8dde4 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -90,9 +90,11 @@ static void get_items_reply(DBusPendingCall *pending, void *_data) {
90 90
91 struct StatusNotifierItem *item = sni_create(name); 91 struct StatusNotifierItem *item = sni_create(name);
92 92
93 sway_log(L_DEBUG, "Item registered with host: %s", name); 93 if (item) {
94 list_add(tray->items, item); 94 sway_log(L_DEBUG, "Item registered with host: %s", name);
95 dirty = true; 95 list_add(tray->items, item);
96 dirty = true;
97 }
96 } 98 }
97 99
98bail: 100bail:
@@ -141,8 +143,10 @@ static DBusHandlerResult signal_handler(DBusConnection *connection,
141 if (list_seq_find(tray->items, sni_str_cmp, name) == -1) { 143 if (list_seq_find(tray->items, sni_str_cmp, name) == -1) {
142 struct StatusNotifierItem *item = sni_create(name); 144 struct StatusNotifierItem *item = sni_create(name);
143 145
144 list_add(tray->items, item); 146 if (item) {
145 dirty = true; 147 list_add(tray->items, item);
148 dirty = true;
149 }
146 } 150 }
147 151
148 return DBUS_HANDLER_RESULT_HANDLED; 152 return DBUS_HANDLER_RESULT_HANDLED;