mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 11:02:44 +00:00
lseek: fix check for vattr.va_size overflow. Check suggested by bde simple not
works with unsigned types.
This commit is contained in:
parent
e02faad5ca
commit
db106eff39
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82207
@ -1640,9 +1640,10 @@ lseek(p, uap)
|
||||
error = VOP_GETATTR(vp, &vattr, cred, p);
|
||||
if (error)
|
||||
return (error);
|
||||
/* 'vattr.va_size' is always >= 0 */
|
||||
if (noneg &&
|
||||
((offset > 0 && vattr.va_size > OFF_MAX - offset) ||
|
||||
(offset < 0 && vattr.va_size < OFF_MIN - offset)))
|
||||
(offset < 0 && vattr.va_size + offset > OFF_MAX)))
|
||||
return (EOVERFLOW);
|
||||
offset += vattr.va_size;
|
||||
break;
|
||||
|
@ -1640,9 +1640,10 @@ lseek(p, uap)
|
||||
error = VOP_GETATTR(vp, &vattr, cred, p);
|
||||
if (error)
|
||||
return (error);
|
||||
/* 'vattr.va_size' is always >= 0 */
|
||||
if (noneg &&
|
||||
((offset > 0 && vattr.va_size > OFF_MAX - offset) ||
|
||||
(offset < 0 && vattr.va_size < OFF_MIN - offset)))
|
||||
(offset < 0 && vattr.va_size + offset > OFF_MAX)))
|
||||
return (EOVERFLOW);
|
||||
offset += vattr.va_size;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user