diff options
author | Calvin Lee <cyrus296@gmail.com> | 2017-07-13 07:47:21 -0700 |
---|---|---|
committer | Calvin Lee <cyrus296@gmail.com> | 2017-07-13 07:47:21 -0700 |
commit | 62223e8fbbccac5581da1464081662b44f8a6e03 (patch) | |
tree | 3ed23fe4384bbc81e2bd9da71a28264aec0742fd /swaybar/tray/sni.c | |
parent | Merge pull request #1272 from ascent12/pointer-fix (diff) | |
download | sway-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/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) { | |||
413 | } | 413 | } |
414 | 414 | ||
415 | struct StatusNotifierItem *sni_create(const char *name) { | 415 | struct StatusNotifierItem *sni_create(const char *name) { |
416 | // Make sure `name` is well formed | ||
417 | if (!dbus_validate_bus_name(name, NULL)) { | ||
418 | sway_log(L_INFO, "Name (%s) is not a bus name. We cannot create an item.", name); | ||
419 | return NULL; | ||
420 | } | ||
421 | |||
416 | struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem)); | 422 | struct StatusNotifierItem *item = malloc(sizeof(struct StatusNotifierItem)); |
417 | item->name = strdup(name); | 423 | item->name = strdup(name); |
418 | item->unique_name = NULL; | 424 | item->unique_name = NULL; |