summaryrefslogtreecommitdiff
path: root/hw/xwin/winmultiwindowwm.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-01-06 13:24:57 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-01-06 13:24:57 +0000
commit3165236483de936b4ca22f8b6d2d2b8b1a1a4909 (patch)
tree38b82398728fd527391a4940d301fd19c97bc470 /hw/xwin/winmultiwindowwm.c
parent591ac9c811de0871d3bdcc19cada0ff6715bf67c (diff)
Fix crash with non-nullterminated strings (reported by Øyvind Harboe)
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 6a58ed298..032835397 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -425,7 +425,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);
}