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