From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199603251758.KAA18221@koala.azstarnet.com> Date: Mon, 25 Mar 1996 10:58:21 -0700 From: David Mosberger-Tang Subject: minor Xlib patch Here is a tiny patch for libX11. Technically, the old code works fine since malloc() will do the required padding. But when running with a debugging malloc() package, it makes a world of a difference. For example, libmcheck (as it comes with GNU libc), will abort() if _XReadPad() writes bytes that were not Xmalloc'ed. Since I try to avoid hacking X11 code as much as possible, I'm not sure who to report this to. Could somebody forward this to the appropriate channel? --david --- XFree86-3.1.2/xc/lib/X11/OpenDis.c~ Wed Mar 20 19:04:34 1996 +++ XFree86-3.1.2/xc/lib/X11/OpenDis.c Mon Mar 25 10:06:01 1996 @@ -567,8 +567,9 @@ req->longLength = 100000000L; if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) { + int padded_len = (reply.nItems + 1 + 0x3) & ~0x3; if (reply.format == 8 && reply.propertyType == XA_STRING && - (dpy->xdefaults = Xmalloc (reply.nItems + 1))) { + (dpy->xdefaults = Xmalloc (padded_len))) { _XReadPad (dpy, dpy->xdefaults, reply.nItems); dpy->xdefaults[reply.nItems] = '\0'; }