summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2021-08-24 13:44:35 +0200
committerrafa_99 <raroma09@gmail.com>2021-08-24 15:14:21 +0100
commit3b794d801692c46e4643562606538424f222a3a9 (patch)
tree8a4ca900fedf6ace17de1e7ba0c502e149be1480
parent384759562cb681a10cf453ca71ad794b3ac89fa1 (diff)
fix possible rare crash when Xutf8TextPropertyToTextList fails
from the XmbTextListToTextProperty(3) man page: "If insufficient memory is available for the new value string, the functions return XNoMemory. If the current locale is not supported, the functions return XLocaleNotSupported. In both of these error cases, the functions do not set text_prop_return." Reported by Steffen Nurpmeso <steffen@sdaoden.eu>, thanks!
-rw-r--r--x.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/x.c b/x.c
index 432da40..0385674 100644
--- a/x.c
+++ b/x.c
@@ -1700,8 +1700,9 @@ xseticontitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
- &prop);
+ if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop) != Success)
+ return;
XSetWMIconName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmiconname);
XFree(prop.value);
@@ -1713,8 +1714,9 @@ xsettitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
- &prop);
+ if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop) != Success)
+ return;
XSetWMName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
XFree(prop.value);