commit 4d6e1b39e14666dd0738301fa0ac1ab246ac1070
parent e36d7dd570a789685c4200e7fc8a929ad6c4ed8c
Author: Anselm R Garbe <garbeam@gmail.com>
Date: Mon, 22 Dec 2014 11:36:47 +0100
segfault avoidance
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lsw.c b/lsw.c
@@ -58,9 +58,9 @@ getname(Window win) {
if(!XmbTextPropertyToTextList(dpy, &prop, &list, &n) && n > 0) {
strncpy(buf, list[0], sizeof buf);
XFreeStringList(list);
- }
- else
+ } else
strncpy(buf, (char *)prop.value, sizeof buf);
XFree(prop.value);
+ buf[sizeof buf - 1] = '\0';
return buf;
}