summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 814d4f60cc1..59ca95ae4d8 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.7 1996/09/04 22:33:48 niklas Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.8 1996/10/26 07:31:48 tholo Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -314,6 +314,13 @@ sys_fcntl(p, v, retval)
return (error);
if (fl.l_whence == SEEK_CUR)
fl.l_start += fp->f_offset;
+ if (fl.l_start < 0)
+ return (EINVAL);
+ if (fl.l_type != F_RDLCK &&
+ fl.l_type != F_WRLCK &&
+ fl.l_type != F_UNLCK &&
+ fl.l_type != 0)
+ return (EINVAL);
error = VOP_ADVLOCK(vp, (caddr_t)p, F_GETLK, &fl, F_POSIX);
if (error)
return (error);