* minor Xlib patch
@ 1996-03-25 17:58 David Mosberger-Tang
0 siblings, 0 replies; only message in thread
From: David Mosberger-Tang @ 1996-03-25 17:58 UTC (permalink / raw)
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';
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-03-25 17:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-03-25 17:58 minor Xlib patch David Mosberger-Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox