Fix alignment issues in FD passing code
authorMark Kettenis <kettenis@openbsd.org>
Mon, 11 Nov 2013 22:11:56 +0000 (23:11 +0100)
committerUli Schlachter <psychon@znc.in>
Mon, 18 Nov 2013 15:52:33 +0000 (16:52 +0100)
commitc7c5b710f2cc0782412c9e159986c96b52aa0d02
tree5aeab7804ba91ac04b50f3a477c441326a6450cc
parente8663a935890ff366f49e356211049dfd0d9756a
Fix alignment issues in FD passing code

A char array on the stack is not guaranteed to have more than byte alignment.
This means that casting it to a 'struct cmsghdr' and accessing its members
may result in unaligned access.  This will generate SIGBUS on struct
alignment architectures like OpenBSD/sparc64.  The canonical solution is to
use a union to force proper alignment.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
Signed-off-by: Uli Schlachter <psychon@znc.in>
src/xcb_conn.c
src/xcb_in.c