Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/kern_time.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/kern_time.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.205 retrieving revision 1.206 diff -u -p -r1.205 -r1.206 --- src/sys/kern/kern_time.c 2020/05/23 23:42:43 1.205 +++ src/sys/kern/kern_time.c 2020/10/27 00:07:18 1.206 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.205 2020/05/23 23:42:43 ad Exp $ */ +/* $NetBSD: kern_time.c,v 1.206 2020/10/27 00:07:18 nia Exp $ */ /*- * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.205 2020/05/23 23:42:43 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.206 2020/10/27 00:07:18 nia Exp $"); #include #include @@ -137,6 +137,13 @@ settime1(struct proc *p, const struct ti { struct timespec delta, now; + /* + * The time being set to an unreasonable value will cause + * unreasonable system behaviour. + */ + if (ts->tv_sec < 0 || ts->tv_sec > (1LL << 36)) + return (EINVAL); + /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */ nanotime(&now); timespecsub(ts, &now, &delta);