diff options
author | ache <ache@FreeBSD.org> | 2001-08-23 16:13:59 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-08-23 16:13:59 +0000 |
commit | 86b9c464000d23c229251d06e9af10b10ab21308 (patch) | |
tree | b7c42badb0ce6e3f682343aa192c0fa6d4eda459 /sys/nfs | |
parent | f8ef40b0cb362d207aa99426ef00cfd469ed0084 (diff) | |
download | FreeBSD-src-86b9c464000d23c229251d06e9af10b10ab21308.zip FreeBSD-src-86b9c464000d23c229251d06e9af10b10ab21308.tar.gz |
Implement l_len<0 per POSIX check.
Check for valid l_whence too.
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_lock.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/nfs/nfs_lock.c b/sys/nfs/nfs_lock.c index ac52410..607662c 100644 --- a/sys/nfs/nfs_lock.c +++ b/sys/nfs/nfs_lock.c @@ -102,12 +102,14 @@ nfs_dolock(ap) * the NLM protocol doesn't allow the server to return an error * on ranges, so we do it. */ - if (fl->l_len < 0) - return (EINVAL); if (fl->l_whence != SEEK_END) { - if (fl->l_start < 0) + if (fl->l_whence != SEEK_CUR || fl->l_whence != SEEK_SET || + fl->l_start < 0 || + (fl->l_len < 0 && + (fl->l_start == 0 || fl->l_start + fl->l_len < 0))) return (EINVAL); - if (fl->l_len != 0 && (fl->l_len - 1 > OFF_MAX - fl->l_start)) + if (fl->l_len > 0 && + (fl->l_len - 1 > OFF_MAX - fl->l_start)) return (EOVERFLOW); } |