[PATCH xserver] dix: Don't leak swapped events
keithp at keithp.com
Wed Mar 29 16:05:00 UTC 2017
Peter Hutterer <peter.hutterer at who-t.net> writes:
> as keith already pointed out, this will break for generic events. but you
> can still get the same effect by switching to
> unsigned char buffer[eventlength];
> xEvent *swapped = buffer;
> and get rid of the heap allocation this way.
You'll have to use 'uint64_t buffer[eventlength/8]' to get the
alignment fixed up, but otherwise, this looks good. Although, frankly,
having a malloc'd buffer which gets resized as necessary is far from the
worse thing this code could do, and avoids stack overflow problems if
'eventlength' turns out to be mis-computed.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 832 bytes
Desc: not available
More information about the xorg-devel