On 1 December 2014 at 21:19, Dimitris Papastamos <s...@2f30.org> wrote: > On Mon, Dec 01, 2014 at 08:09:40PM +0000, Dimitris Papastamos wrote: >> 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; > > If we do hit this case, it will result in truncation so it may be > better to strdup() after all. This just patch just avoids a segfault > basically.
IMO the truncation is ok given the fact that lsw output is not ultra-critical in terms of full matching for postprocessing input. Even decorating WMs would truncate. So I applied this suggestion! Thanks and BR, Anselm