commit 4d6e1b39e14666dd0738301fa0ac1ab246ac1070
Author: Anselm R Garbe <[email protected]>
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
@@ -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;
 }

Reply via email to