diff --git a/CHANGES b/CHANGES index becaa95aed..4ef266396b 100644 --- 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] diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index aef2538752..a0b8f9d0e5 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -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; }