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.

Reply via email to