Module Name: src Committed By: kamil Date: Fri Sep 20 15:05:22 UTC 2019
Modified Files: src/sys/compat/common: kern_select_50.c Log Message: Validate usec ranges in compat_50_sys_select() Later in the code selcommon() checks for proper timespec, check only correct usec of timeval before type conversions. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/kern_select_50.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/kern_select_50.c diff -u src/sys/compat/common/kern_select_50.c:1.2 src/sys/compat/common/kern_select_50.c:1.3 --- src/sys/compat/common/kern_select_50.c:1.2 Sun Jan 27 02:08:39 2019 +++ src/sys/compat/common/kern_select_50.c Fri Sep 20 15:05:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: kern_select_50.c,v 1.3 2019/09/20 15:05:22 kamil Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.3 2019/09/20 15:05:22 kamil Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -114,6 +114,10 @@ compat_50_sys_select(struct lwp *l, error = copyin(SCARG(uap, tv), (void *)&atv50, sizeof(atv50)); if (error) return error; + + if (atv50.tv_usec < 0 || atv50.tv_usec >= 1000000) + return EINVAL; + ats.tv_sec = atv50.tv_sec; ats.tv_nsec = atv50.tv_usec * 1000; ts = &ats;