termux-packages/x11-packages/st/x.c-xsettitle-check-return-value.patch
Tee KOBAYASHI aee88ebe56 st: Fix invalid free() in xsettitle()
by checking return value of `Xutf8TextListToTextProperty()`.
2022-04-25 09:57:01 +09:00

19 lines
419 B
Diff

--- a/x.c
+++ b/x.c
@@ -1585,11 +1585,14 @@
void
xsettitle(char *p)
{
+ int r;
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ r = Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop);
+ if (r != Success)
+ return;
XSetWMName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
XFree(prop.value);