[hackers] [dwm] gettextprop: check result of XGetTextProperty (undefined behaviour for XFree) || Hiltjo Posthuma
commit 99f78fa553f9ddb23fab73e47a408d66ca7f974c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri Nov 3 16:36:32 2017 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Fri Nov 3 21:14:58 2017 +0100
gettextprop: check result of XGetTextProperty (undefined behaviour for XFree)
diff --git a/dwm.c b/dwm.c
index b0d99c0..650d19f 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -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);
Received on Fri Nov 03 2017 - 21:21:35 CET
This archive was generated by hypermail 2.3.0
: Fri Nov 03 2017 - 21:24:20 CET