Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Validate usec ranges in compat_50_netbsd...
details: https://anonhg.NetBSD.org/src/rev/b04093ac92f9
branches: trunk
changeset: 845158:b04093ac92f9
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Sep 20 15:09:07 2019 +0000
description:
Validate usec ranges in compat_50_netbsd32_select()
Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.
diffstat:
sys/compat/netbsd32/netbsd32_compat_50.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r c748235c0087 -r b04093ac92f9 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Fri Sep 20 15:05:22 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Fri Sep 20 15:09:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.40 2019/09/20 15:09:07 kamil Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.40 2019/09/20 15:09:07 kamil Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -140,6 +140,10 @@
error = copyin(SCARG_P32(uap, tv), &tv32, sizeof(tv32));
if (error != 0)
return error;
+
+ if (tv32.tv_usec < 0 || tv32.tv_usec >= 1000000)
+ return EINVAL;
+
ats.tv_sec = tv32.tv_sec;
ats.tv_nsec = tv32.tv_usec * 1000;
ts = &ats;
Home |
Main Index |
Thread Index |
Old Index