aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-07-03 16:26:11 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-07-06 11:45:35 -0300
commitf7de21498dc6c517969315dcb3a675072c2cc87f (patch)
tree9c80354d3661602aa54afce738fecb15ea775a5e
parent4b93a93e407308000ee6a1c3fec3715127c2c4c5 (diff)
downloadglibc-f7de21498dc6c517969315dcb3a675072c2cc87f.zip
glibc-f7de21498dc6c517969315dcb3a675072c2cc87f.tar.gz
glibc-f7de21498dc6c517969315dcb3a675072c2cc87f.tar.bz2
linux: Use the expected size for SO_TIMESTAMP{NS} convertion
Kernel returns 32-bit values for COMPAT_SO_TIMESTAMP{NS}_OLD, not 64-bit values. Checked on x86_64-linux-gnu and i686-linux-gnu.
-rw-r--r--sysdeps/unix/sysv/linux/convert_scm_timestamps.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
index 5af7184..00c934c 100644
--- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
+++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
@@ -44,7 +44,8 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
'struct __kernel_sock_timeval' while for SO_TIMESTAMPNS_NEW is a
'struct __kernel_timespec'. In either case it is two uint64_t
members. */
- uint64_t tvts[2];
+ int64_t tvts[2];
+ int32_t tmp[2];
struct cmsghdr *cmsg, *last = NULL;
int type = 0;
@@ -69,7 +70,9 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
/* fallthrough */
common:
- memcpy (tvts, CMSG_DATA (cmsg), sizeof (tvts));
+ memcpy (tmp, CMSG_DATA (cmsg), sizeof (tmp));
+ tvts[0] = tmp[0];
+ tvts[1] = tmp[1];
break;
}