Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Validate usec ranges in settimeofday1()



details:   https://anonhg.NetBSD.org/src/rev/f9f8399e3dbf
branches:  trunk
changeset: 965519:f9f8399e3dbf
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Sep 20 14:12:57 2019 +0000

description:
Validate usec ranges in settimeofday1()

diffstat:

 sys/kern/kern_time.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 09b284ad0e75 -r f9f8399e3dbf sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Fri Sep 20 13:43:47 2019 +0000
+++ b/sys/kern/kern_time.c      Fri Sep 20 14:12:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.199 2019/08/07 07:22:12 mrg Exp $      */
+/*     $NetBSD: kern_time.c,v 1.200 2019/09/20 14:12:57 kamil Exp $    */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.199 2019/08/07 07:22:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.200 2019/09/20 14:12:57 kamil Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -482,6 +482,9 @@
                utv = &atv;
        }
 
+       if (utv->tv_usec < 0 || utv->tv_usec >= 1000000)
+               return EINVAL;
+
        TIMEVAL_TO_TIMESPEC(utv, &ts);
        return settime1(l->l_proc, &ts, check_kauth);
 }



Home | Main Index | Thread Index | Old Index