summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 09c06adb1e..3cf65b3553 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -987,7 +987,8 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
if (cmsgptr->cmsg_len == CMSG_LEN(sizeof(int))
&& ((cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT)
|| (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_TTL))) {
- header->hopLimit = *reinterpret_cast<int *>(CMSG_DATA(cmsgptr));
+ Q_STATIC_ASSERT(sizeof(header->hopLimit) == sizeof(int));
+ memcpy(&header->hopLimit, CMSG_DATA(cmsgptr), sizeof(header->hopLimit));
}
#ifndef QT_NO_SCTP