From 6fb9fbceab43c80a8d8ad50da5dd3b6070b5bd04 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 23 Aug 2001 17:09:23 +0000 Subject: [PATCH] Add yet one check for SEEK_END overflow --- sys/kern/kern_lockf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index de8c75daeef6..53c6017739b7 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -122,7 +122,8 @@ lf_advlock(ap, head, size) case SEEK_END: /* 'size' is always >= 0 */ - if (fl->l_start > 0 && size > OFF_MAX - fl->l_start) + if ((fl->l_start > 0 && size > OFF_MAX - fl->l_start) || + (fl->l_start < 0 && size + fl->l_start > OFF_MAX)) return (EOVERFLOW); start = size + fl->l_start; break;