diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2017-11-03 16:36:32 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2017-11-03 21:14:58 +0100 |
commit | 99f78fa553f9ddb23fab73e47a408d66ca7f974c (patch) | |
tree | 3e03dccedc131f19a9e9916b1cf0111016f80f5d | |
parent | a9b6a312a77b9cc81ca8b08a95c09e9f7948d7a6 (diff) | |
download | dwm-99f78fa553f9ddb23fab73e47a408d66ca7f974c.tar.gz dwm-99f78fa553f9ddb23fab73e47a408d66ca7f974c.tar.bz2 dwm-99f78fa553f9ddb23fab73e47a408d66ca7f974c.zip |
gettextprop: check result of XGetTextProperty (undefined behaviour for XFree)
-rw-r--r-- | dwm.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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); |