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 netbsd32___selec...



details:   https://anonhg.NetBSD.org/src/rev/5a5a9c00d28c
branches:  trunk
changeset: 459668:5a5a9c00d28c
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Sep 20 15:16:41 2019 +0000

description:
Validate usec ranges in netbsd32___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.

diffstat:

 sys/compat/netbsd32/netbsd32_select.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r dd0018fa288e -r 5a5a9c00d28c sys/compat/netbsd32/netbsd32_select.c
--- a/sys/compat/netbsd32/netbsd32_select.c     Fri Sep 20 15:09:07 2019 +0000
+++ b/sys/compat/netbsd32/netbsd32_select.c     Fri Sep 20 15:16:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_select.c,v 1.19 2010/04/23 15:19:20 rmind Exp $       */
+/*     $NetBSD: netbsd32_select.c,v 1.20 2019/09/20 15:16:41 kamil Exp $       */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.19 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.20 2019/09/20 15:16:41 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,6 +68,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