]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: align buffers for control messages
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 1 Aug 2016 14:57:09 +0000 (16:57 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 11 Aug 2016 08:45:47 +0000 (10:45 +0200)
ntp_io.c

index 5efc2a2f1259d4c5013fbe2ca1acee2fe5b8ba5e..2492272a931b4ca8afbfaa91a4f4e65b4273cd72 100644 (file)
--- 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;