summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2017-04-15 15:30:28 +0000
committerdchagin <dchagin@FreeBSD.org>2017-04-15 15:30:28 +0000
commit8ebaceacc25e8a3a05fa301a71502a13b517b02b (patch)
tree3594bba357ac425c8cc9b39d726fcce6c728f7f3
parent2294073c02b1cc4affd731619f63d8a291d583c5 (diff)
downloadFreeBSD-src-8ebaceacc25e8a3a05fa301a71502a13b517b02b.zip
FreeBSD-src-8ebaceacc25e8a3a05fa301a71502a13b517b02b.tar.gz
MFC r316393:
As noted by bde@ negative tv_sec values are not checked for overflow, so overflow can still occur. Fix that. Also remove the extra check for tv_sec size as under COMPAT_LINUX32 it is always true.
-rw-r--r--sys/compat/linux/linux_time.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c
index 5c66b1a..dca960d 100644
--- a/sys/compat/linux/linux_time.c
+++ b/sys/compat/linux/linux_time.c
@@ -125,8 +125,7 @@ native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp);
#ifdef COMPAT_LINUX32
- if (ntp->tv_sec > INT_MAX &&
- sizeof(ltp->tv_sec) != sizeof(ntp->tv_sec))
+ if (ntp->tv_sec > INT_MAX || ntp->tv_sec < INT_MIN)
return (EOVERFLOW);
#endif
ltp->tv_sec = ntp->tv_sec;
OpenPOWER on IntegriCloud