From 82e76c39d9769e9bca02a122fccd6b3e85fce4d2 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 1 Aug 2016 16:57:09 +0200 Subject: [PATCH] ntp: align buffers for control messages --- ntp_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntp_io.c b/ntp_io.c index 5efc2a2..2492272 100644 --- a/ntp_io.c +++ b/ntp_io.c @@ -41,6 +41,7 @@ #include "util.h" #define INVALID_SOCK_FD -1 +#define CMSGBUF_SIZE 256 union sockaddr_in46 { struct sockaddr_in in4; @@ -495,7 +496,7 @@ read_from_socket(int sock_fd, int event, void *anything) double now_err; NTP_Remote_Address remote_addr; NTP_Local_Address local_addr; - char cmsgbuf[256]; + struct cmsghdr cmsgbuf[CMSGBUF_SIZE / sizeof (struct cmsghdr)]; struct msghdr msg; struct iovec iov; struct cmsghdr *cmsg; @@ -590,7 +591,7 @@ send_packet(void *packet, int packetlen, NTP_Remote_Address *remote_addr, NTP_Lo union sockaddr_in46 remote; struct msghdr msg; struct iovec iov; - char cmsgbuf[256]; + struct cmsghdr cmsgbuf[CMSGBUF_SIZE / sizeof (struct cmsghdr)]; int cmsglen; socklen_t addrlen = 0;