]> git.tuebingen.mpg.de Git - paraslash.git/commit
Avoid member access within misaligned address for ancillary data buffer.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 16 Mar 2016 22:05:56 +0000 (23:05 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 28 Mar 2016 17:16:16 +0000 (17:16 +0000)
commit985ba0546ab18eadf73d0a2686029a3ac876c846
treeca7f1926c9459bb57c3c77c235440af41682b988
parent66b8dbf57fe5e4c940caef0493e81987ced2dc4a
Avoid member access within misaligned address for ancillary data buffer.

For glibc-2.23, the CMSG_FIRSTHDR macro is defined as

#define CMSG_FIRSTHDR(mhdr) \
  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)                 \
   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)

In recv_cred_buffer(), pass_afd() and dispose_fds() the on-stack
ancillary data buffer is not necessarily aligned. The pointer is
cast to struct cmsghdr *, then dereferenced, resulting in undefined
behaviour due to the lack of alignment.

This patch asks the compiler to align the ancillary data buffers.
afs.c
net.c
vss.c