Added check for negative seconds value. Found by syscall() fuzzing.

MFC after:	1 week
This commit is contained in:
Peter Holm 2011-11-18 19:14:42 +00:00
parent 1a1f41b8fe
commit 7bbcd22d38
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227674

View File

@ -474,7 +474,8 @@ kern_thr_suspend(struct thread *td, struct timespec *tsp)
}
if (tsp != NULL) {
if (tsp->tv_nsec < 0 || tsp->tv_nsec > 1000000000)
if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 ||
tsp->tv_nsec > 1000000000)
return (EINVAL);
if (tsp->tv_sec == 0 && tsp->tv_nsec == 0)
error = EWOULDBLOCK;