[hackers] [lsw] segfault avoidance || Anselm R Garbe
commit 4d6e1b39e14666dd0738301fa0ac1ab246ac1070
Author: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon Dec 22 11:36:47 2014 +0100
segfault avoidance
diff --git a/lsw.c b/lsw.c
index 9b01f6a..fc40fef 100644
--- a/lsw.c
+++ b/lsw.c
_AT_@ -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;
}
Received on Mon Dec 22 2014 - 11:36:57 CET
This archive was generated by hypermail 2.3.0
: Mon Dec 22 2014 - 11:48:20 CET