aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Stephan Hilb <stephan@ecshi.net>2019-03-13 21:32:02 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-13 22:04:04 -0600
commitd64e8ba9469f4fa0ff693a22c88c1afa687c4c6c (patch)
tree19265f09979b0990599ac11087438d3dde706a27 /swaybar
parentxwayland: handle floating configure request size (diff)
downloadsway-d64e8ba9469f4fa0ff693a22c88c1afa687c4c6c.tar.gz
sway-d64e8ba9469f4fa0ff693a22c88c1afa687c4c6c.tar.zst
sway-d64e8ba9469f4fa0ff693a22c88c1afa687c4c6c.zip
swaybar: fix loading of malformed icon theme
If the icon index.theme contained a key-value pair without a preceding group header, entry_handler() would be called with a zero pointer and lead to a segfault. Set the error flag and break on such malformed files.
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/tray/icon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c
index 2276e36d..8587f3f7 100644
--- a/swaybar/tray/icon.c
+++ b/swaybar/tray/icon.c
@@ -243,6 +243,10 @@ static struct icon_theme *read_theme_file(char *basedir, char *theme_name) {
243 free(group); 243 free(group);
244 group = strdup(&line[1]); 244 group = strdup(&line[1]);
245 } else { // key-value pair 245 } else { // key-value pair
246 if (!group) {
247 error = true;
248 break;
249 }
246 // check well-formed 250 // check well-formed
247 int eok = 0; 251 int eok = 0;
248 for (; isalnum(line[eok]) || line[eok] == '-'; ++eok) {} // TODO locale? 252 for (; isalnum(line[eok]) || line[eok] == '-'; ++eok) {} // TODO locale?