From a93d3cd2812b6b19bd0f8358898e14ba84a6461e Mon Sep 17 00:00:00 2001 From: tholo Date: Sun, 2 Feb 1997 00:32:02 +0000 Subject: [PATCH] Prevent seeking to negative offsets when seeking from the end of a file; noticed by Tim Newsham --- sys/kern/vfs_syscalls.c | 4 ++-- 1 file 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; -- 2.20.1