dwm
dynamic window manager
git clone https://9o.is/git/dwm.git
commit 771bd1711f7a5166a2ab1dbf424ae883bcba7b69 parent a1861872a25f3e26120905f3a08220b5cbeaf3f1 Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Fri, 3 Nov 2017 16:36:32 +0100 gettextprop: check result of XGetTextProperty (undefined behaviour for XFree) Diffstat:
| M | dwm.c | | | 3 | +-- |
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dwm.c b/dwm.c @@ -910,8 +910,7 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) if (!text || size == 0) return 0; text[0] = '\0'; - XGetTextProperty(dpy, w, &name, atom); - if (!name.nitems) + if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems) return 0; if (name.encoding == XA_STRING) strncpy(text, (char *)name.value, size - 1);