summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1997-02-02 00:32:03 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1997-02-02 00:32:03 +0000
commit3882b3741f210e5d7911f573f8394c9980090009 (patch)
tree140f1e46fbf3b7ff645597b00dca448d1e541f53
parent58448c346f12c2c78a0ace7761ff0092faa9323c (diff)
Prevent seeking to negative offsets when seeking from the end of a file;
noticed by Tim Newsham <newsham@aloha.net>
-rw-r--r--sys/kern/vfs_syscalls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 4ebf43cc0d0..1148201af3b 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.20 1997/01/26 05:18:29 downsj Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.21 1997/02/02 00:32:02 tholo Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1167,7 +1167,7 @@ sys_lseek(p, v, retval)
cred, p);
if (error)
return (error);
- if (vattr.va_size + SCARG(uap, offset) < 0)
+ if ((off_t)vattr.va_size + SCARG(uap, offset) < 0)
return (EINVAL);
fp->f_offset = SCARG(uap, offset) + vattr.va_size;
break;