Module Name:    src
Committed By:   kamil
Date:           Fri Sep 20 14:12:57 UTC 2019

Modified Files:
        src/sys/kern: kern_time.c

Log Message:
Validate usec ranges in settimeofday1()


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/kern/kern_time.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/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.199 src/sys/kern/kern_time.c:1.200
--- src/sys/kern/kern_time.c:1.199	Wed Aug  7 07:22:12 2019
+++ src/sys/kern/kern_time.c	Fri Sep 20 14:12:57 2019
@@ -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 @@ settimeofday1(const struct timeval *utv,
 		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);
 }

Reply via email to