mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
advlock: simplify overflow checks
This commit is contained in:
parent
63347f1e8f
commit
c8e7634357
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82516
@ -307,10 +307,9 @@ fcntl(p, uap)
|
||||
return (error);
|
||||
}
|
||||
if (fl.l_whence == SEEK_CUR) {
|
||||
if ((fl.l_start > 0 &&
|
||||
fp->f_offset > OFF_MAX - fl.l_start) ||
|
||||
(fl.l_start < 0 &&
|
||||
fp->f_offset < OFF_MIN - fl.l_start)) {
|
||||
if (fp->f_offset < 0 ||
|
||||
(fl.l_start > 0 &&
|
||||
fp->f_offset > OFF_MAX - fl.l_start)) {
|
||||
fdrop(fp, p);
|
||||
return (EOVERFLOW);
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ lf_advlock(ap, head, size)
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
if ((fl->l_start > 0 && size > OFF_MAX - fl->l_start) ||
|
||||
(fl->l_start < 0 && size + fl->l_start > OFF_MAX))
|
||||
if (size > OFF_MAX ||
|
||||
(fl->l_start > 0 && size > OFF_MAX - fl->l_start))
|
||||
return (EOVERFLOW);
|
||||
start = size + fl->l_start;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user