summaryrefslogtreecommitdiff
path: root/hw/xwin/winmultiwindowwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xwin/winmultiwindowwm.c')
-rw-r--r--hw/xwin/winmultiwindowwm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 3c82aee90..1a0ddf519 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -405,7 +405,10 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
/* */
if (xtpName.value)
{
- *ppName = strdup ((char*)xtpName.value);
+ int size = xtpName.nitems * (xtpName.format >> 3);
+ *ppName = malloc(size + 1);
+ strncpy(*ppName, xtpName.value, size);
+ (*ppName)[size] = 0;
XFree (xtpName.value);
}