mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 18:01:37 -05:00
Fix crash on NULL class/name strings in bar. Reported by and similar diff
from Gregory Edigarov. ok marco
This commit is contained in:
parent
53da032ea7
commit
0717d488f8
1 changed files with 6 additions and 4 deletions
10
scrotwm.c
10
scrotwm.c
|
@ -566,7 +566,7 @@ bar_update(void)
|
||||||
time_t tmt;
|
time_t tmt;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
struct swm_region *r;
|
struct swm_region *r;
|
||||||
int i, x;
|
int i, x, do_class, do_name;
|
||||||
size_t len;
|
size_t len;
|
||||||
char s[SWM_BAR_MAX];
|
char s[SWM_BAR_MAX];
|
||||||
char loc[SWM_BAR_MAX];
|
char loc[SWM_BAR_MAX];
|
||||||
|
@ -606,11 +606,13 @@ bar_update(void)
|
||||||
status = XGetClassHint(display, cur_focus->id, xch);
|
status = XGetClassHint(display, cur_focus->id, xch);
|
||||||
if (status == BadWindow || status == BadAlloc)
|
if (status == BadWindow || status == BadAlloc)
|
||||||
goto out;
|
goto out;
|
||||||
if (title_class_enabled)
|
do_class = (title_class_enabled && xch->res_class != NULL);
|
||||||
|
do_name = (title_name_enabled && xch->res_name != NULL);
|
||||||
|
if (do_class)
|
||||||
strlcat(s, xch->res_class, sizeof s);
|
strlcat(s, xch->res_class, sizeof s);
|
||||||
if (title_name_enabled && title_class_enabled)
|
if (do_class && do_name)
|
||||||
strlcat(s, ":", sizeof s);
|
strlcat(s, ":", sizeof s);
|
||||||
if (title_name_enabled)
|
if (do_name)
|
||||||
strlcat(s, xch->res_name, sizeof s);
|
strlcat(s, xch->res_name, sizeof s);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Add table
Reference in a new issue