Add yet one check for SEEK_END overflow

This commit is contained in:
Andrey A. Chernov 2001-08-23 17:09:23 +00:00
parent c18092b2fb
commit 6fb9fbceab

View File

@ -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;