]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3412. [bug] Copy timeval structure from control message data.
authorMark Andrews <marka@isc.org>
Thu, 1 Nov 2012 00:16:59 +0000 (11:16 +1100)
committerMark Andrews <marka@isc.org>
Thu, 1 Nov 2012 00:16:59 +0000 (11:16 +1100)
                        [RT #31548]

CHANGES
lib/isc/unix/socket.c

diff --git a/CHANGES b/CHANGES
index becaa95aed4d927c40b6ce9ba1d145f018ba9e2c..4ef266396b8eca4148f58a433c302492a7a570e9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3412.  [bug]           Copy timeval structure from control message data.
+                       [RT #31548]
+
 3411.  [tuning]        Use IPV6_USE_MIN_MTU or equivalent with TCP in addition
                        to UDP. [RT #31690]
 
index aef25387522193c1cb12677def49cbc071183279..a0b8f9d0e54e71112c63371059926e74ab60e693 100644 (file)
@@ -1223,7 +1223,7 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
        struct in6_pktinfo *pktinfop;
 #endif
 #ifdef SO_TIMESTAMP
-       struct timeval *timevalp;
+       void *timevalp;
 #endif
 #endif
 
@@ -1290,9 +1290,11 @@ process_cmsg(isc__socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
 #ifdef SO_TIMESTAMP
                if (cmsgp->cmsg_level == SOL_SOCKET
                    && cmsgp->cmsg_type == SCM_TIMESTAMP) {
-                       timevalp = (struct timeval *)CMSG_DATA(cmsgp);
-                       dev->timestamp.seconds = timevalp->tv_sec;
-                       dev->timestamp.nanoseconds = timevalp->tv_usec * 1000;
+                       struct timeval tv;
+                       timevalp = CMSG_DATA(cmsgp);
+                       memcpy(&tv, timevalp, sizeof(tv));
+                       dev->timestamp.seconds = tv.tv_sec;
+                       dev->timestamp.nanoseconds = tv.tv_usec * 1000;
                        dev->attributes |= ISC_SOCKEVENTATTR_TIMESTAMP;
                        goto next;
                }