Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix crash on NULL class/name strings in bar. Reported by and similar diff
[spectrwm.git]
/
scrotwm.c
diff --git
a/scrotwm.c
b/scrotwm.c
index
ca4a07a
..
045bc53
100644
(file)
--- a/
scrotwm.c
+++ b/
scrotwm.c
@@
-566,7
+566,7
@@
bar_update(void)
time_t tmt;
struct tm tm;
struct swm_region *r;
time_t tmt;
struct tm tm;
struct swm_region *r;
- int i, x;
+ int i, x, do_class, do_name;
size_t len;
char s[SWM_BAR_MAX];
char loc[SWM_BAR_MAX];
size_t len;
char s[SWM_BAR_MAX];
char loc[SWM_BAR_MAX];
@@
-606,11
+606,13
@@
bar_update(void)
status = XGetClassHint(display, cur_focus->id, xch);
if (status == BadWindow || status == BadAlloc)
goto out;
status = XGetClassHint(display, cur_focus->id, xch);
if (status == BadWindow || status == BadAlloc)
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);
}
out:
strlcat(s, xch->res_name, sizeof s);
}
out:
@@
-2381,7
+2383,8
@@
const char *quirkname[] = {
"FULLSCREEN",
};
"FULLSCREEN",
};
-#define SWM_Q_WS "\n| \t"
+/* SWM_Q_WS: retain '|' for back compat for now (2009-08-11) */
+#define SWM_Q_WS "\n|+ \t"
int
parsequirks(char *qstr, unsigned long *quirk)
{
int
parsequirks(char *qstr, unsigned long *quirk)
{