Make sure `olddelta' is a valid pointer before performing the guts of

the adjtime(2) system call.  Fixes PR #7721, Darren Reed.
This commit is contained in:
thorpej 1999-06-07 22:33:53 +00:00
parent b7ee76f1c4
commit 1c5f2999b2
1 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.36 1998/08/18 06:27:01 thorpej Exp $ */
/* $NetBSD: kern_time.c,v 1.37 1999/06/07 22:33:53 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -50,6 +50,9 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <vm/vm.h>
#include <uvm/uvm_extern.h>
#if defined(NFS) || defined(NFSSERVER)
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
@ -344,6 +347,10 @@ sys_adjtime(p, v, retval)
error = copyin(SCARG(uap, delta), &atv, sizeof(struct timeval));
if (error)
return (error);
if (SCARG(uap, olddelta) != NULL &&
uvm_useracc((caddr_t)SCARG(uap, olddelta), sizeof(struct timeval),
B_WRITE) == FALSE)
return (EFAULT);
/*
* Compute the total correction and the rate at which to apply it.