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/5ac29195541b
branches:  trunk
changeset: 454530:5ac29195541b
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 0e20be7155d9 -r 5ac29195541b 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