summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorHiltjo Posthuma2017-11-03 16:36:32 +0100
committerHiltjo Posthuma2017-11-03 21:14:58 +0100
commita5a1ea1a08357fd9720c74ff70dc5e2ec22c7067 (patch)
treebe031402a7006427dc151ac3db23e6100b4448a5
parente5997be45a74d3cfd57c78edf22abf198e7c1ac0 (diff)
downloadaur-a5a1ea1a08357fd9720c74ff70dc5e2ec22c7067.tar.gz
gettextprop: check result of XGetTextProperty (undefined behaviour for XFree)
-rw-r--r--dwm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/dwm.c b/dwm.c
index b0d99c05ffe..650d19f8ebe 100644
--- 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);