mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Check for (old|new)size + 1 overflows off_t.
PR: 204230 MFC after: 1 week
This commit is contained in:
parent
8e7baabc9f
commit
0755c17500
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290336
@ -237,7 +237,8 @@ int main(int argc,char *argv[])
|
||||
err(1, "%s", argv[1]);
|
||||
|
||||
if (oldsize > SSIZE_MAX ||
|
||||
(uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t)) {
|
||||
(uintmax_t)oldsize >= SIZE_T_MAX / sizeof(off_t) ||
|
||||
oldsize == OFF_MAX) {
|
||||
errno = EFBIG;
|
||||
err(1, "%s", argv[1]);
|
||||
}
|
||||
@ -260,7 +261,8 @@ int main(int argc,char *argv[])
|
||||
((newsize=lseek(fd,0,SEEK_END))==-1))
|
||||
err(1, "%s", argv[2]);
|
||||
|
||||
if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX) {
|
||||
if (newsize > SSIZE_MAX || (uintmax_t)newsize >= SIZE_T_MAX ||
|
||||
newsize == OFF_MAX) {
|
||||
errno = EFBIG;
|
||||
err(1, "%s", argv[2]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user