diff options
author | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-10-03 00:07:21 +0000 |
---|---|---|
committer | Thomas Nordin <nordin@cvs.openbsd.org> | 2002-10-03 00:07:21 +0000 |
commit | 516b99b6b962f268d4c7a3e6c541ed7c926fccf6 (patch) | |
tree | 75719ebad5553040ff4acff8c7895af0048961d4 /sys/compat | |
parent | cf6c9b5c49913eb8a64b0df472988e627ffc5bc6 (diff) |
Check for negative values here too. "makes sense" mickey@, ok deraadt@
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/common/kern_resource_43.c | 8 | ||||
-rw-r--r-- | sys/compat/common/vfs_syscalls_43.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/compat/common/kern_resource_43.c b/sys/compat/common/kern_resource_43.c index 0f5c77b6de9..5b05f8eb2c3 100644 --- a/sys/compat/common/kern_resource_43.c +++ b/sys/compat/common/kern_resource_43.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource_43.c,v 1.3 2001/11/06 19:53:17 miod Exp $ */ +/* $OpenBSD: kern_resource_43.c,v 1.4 2002/10/03 00:07:19 nordin Exp $ */ /* $NetBSD: kern_resource_43.c,v 1.4 1996/03/14 19:31:46 christos Exp $ */ /*- @@ -62,12 +62,12 @@ compat_43_sys_getrlimit(p, v, retval) register_t *retval; { register struct compat_43_sys_getrlimit_args /* { - syscallarg(u_int) which; + syscallarg(int) which; syscallarg(struct ogetrlimit *) rlp; } */ *uap = v; struct orlimit olim; - if (SCARG(uap, which) >= RLIM_NLIMITS) + if (SCARG(uap, which) < 0 || SCARG(uap, which) >= RLIM_NLIMITS) return (EINVAL); olim.rlim_cur = p->p_rlimit[SCARG(uap, which)].rlim_cur; if (olim.rlim_cur == -1) @@ -87,7 +87,7 @@ compat_43_sys_setrlimit(p, v, retval) register_t *retval; { struct compat_43_sys_setrlimit_args /* { - syscallarg(u_int) which; + syscallarg(int) which; syscallarg(struct ogetrlimit *) rlp; } */ *uap = v; struct orlimit olim; diff --git a/sys/compat/common/vfs_syscalls_43.c b/sys/compat/common/vfs_syscalls_43.c index 1e6d437229b..4106703df2e 100644 --- a/sys/compat/common/vfs_syscalls_43.c +++ b/sys/compat/common/vfs_syscalls_43.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls_43.c,v 1.20 2002/08/23 15:39:31 art Exp $ */ +/* $OpenBSD: vfs_syscalls_43.c,v 1.21 2002/10/03 00:07:20 nordin Exp $ */ /* $NetBSD: vfs_syscalls_43.c,v 1.4 1996/03/14 19:31:52 christos Exp $ */ /* @@ -341,7 +341,7 @@ compat_43_sys_getdirentries(p, v, retval) register struct compat_43_sys_getdirentries_args /* { syscallarg(int) fd; syscallarg(char *) buf; - syscallarg(u_int) count; + syscallarg(int) count; syscallarg(long *) basep; } */ *uap = v; struct vnode *vp; @@ -353,6 +353,8 @@ compat_43_sys_getdirentries(p, v, retval) int error, eofflag, readcnt; long loff; + if (SCARG(uap, count) < 0) + return EINVAL; if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { |