diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-07-13 10:53:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 10:53:54 -0400 |
commit | e33792e80a095b8619951e8c9c4fa0d16aa4c495 (patch) | |
tree | 3ed23fe4384bbc81e2bd9da71a28264aec0742fd /swaybar/tray/sni.c | |
parent | 13ed84e8865c02b808444202e6e347d870c5d0e9 (diff) | |
parent | 62223e8fbbccac5581da1464081662b44f8a6e03 (diff) |
Merge pull request #1276 from 4e554c4c/bad_items
Don't trust SNI names, fixes #1274
Diffstat (limited to 'swaybar/tray/sni.c')
-rw-r--r-- | swaybar/tray/sni.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/swaybar/tray/sni.c b/swaybar/tray/sni.c index 0c46d5c0..d9a5ca80 100644 --- a/swaybar/tray/sni.c +++ b/swaybar/tray/sni.c @@ -413,6 +413,12 @@ static void get_unique_name(struct StatusNotifierItem *item) { } struct StatusNotifierItem *sni_create(const char *name) { + // Make sure `name` is well formed + if (!dbus_validate_bus_name(name, NULL)) { + sway_log(L_INFO, "Name (%s) is not a bus name. We cannot create an item.", name); + return NULL; + } + struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem)); item->name = strdup(name); item->unique_name = NULL; |