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.
This commit is contained in:
parent
0af3675487
commit
68ab6f5a50
|
@ -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.
|
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <sys/cdefs.h>
|
#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)
|
#if defined(_KERNEL_OPT)
|
||||||
#include "opt_compat_netbsd.h"
|
#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));
|
error = copyin(SCARG(uap, tv), (void *)&atv50, sizeof(atv50));
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
if (atv50.tv_usec < 0 || atv50.tv_usec >= 1000000)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
ats.tv_sec = atv50.tv_sec;
|
ats.tv_sec = atv50.tv_sec;
|
||||||
ats.tv_nsec = atv50.tv_usec * 1000;
|
ats.tv_nsec = atv50.tv_usec * 1000;
|
||||||
ts = &ats;
|
ts = &ats;
|
||||||
|
|
Loading…
Reference in New Issue