mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +01:00
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.
This commit is contained in:
parent
acdb4ed7a3
commit
d64e8ba946
1 changed files with 4 additions and 0 deletions
|
@ -243,6 +243,10 @@ static struct icon_theme *read_theme_file(char *basedir, char *theme_name) {
|
||||||
free(group);
|
free(group);
|
||||||
group = strdup(&line[1]);
|
group = strdup(&line[1]);
|
||||||
} else { // key-value pair
|
} else { // key-value pair
|
||||||
|
if (!group) {
|
||||||
|
error = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
// check well-formed
|
// check well-formed
|
||||||
int eok = 0;
|
int eok = 0;
|
||||||
for (; isalnum(line[eok]) || line[eok] == '-'; ++eok) {} // TODO locale?
|
for (; isalnum(line[eok]) || line[eok] == '-'; ++eok) {} // TODO locale?
|
||||||
|
|
Loading…
Reference in a new issue