Merge pull request #1276 from 4e554c4c/bad_items

Don't trust SNI names, fixes #1274
This commit is contained in:
Drew DeVault 2017-07-13 10:53:54 -04:00
parent 54cd2236c4
commit 0048a3e963
3 changed files with 16 additions and 5 deletions

View file

@ -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;