public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] linux: Use the expected size for SO_TIMESTAMP{NS} convertion
@ 2021-07-06 14:45 Adhemerval Zanella
0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2021-07-06 14:45 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f7de21498dc6c517969315dcb3a675072c2cc87f
commit f7de21498dc6c517969315dcb3a675072c2cc87f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Sat Jul 3 16:26:11 2021 -0300
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.
Diff:
---
sysdeps/unix/sysv/linux/convert_scm_timestamps.c | 7 +++++--
1 file 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 5af71847f5..00c934c413 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-06 14:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:45 [glibc] linux: Use the expected size for SO_TIMESTAMP{NS} convertion Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).