Add more overflow checks in case of fseek()
This commit is contained in:
parent
555ada99b6
commit
28f5a91209
@ -155,6 +155,10 @@ _fseeko(fp, offset, whence, ltest)
|
||||
errno = EINVAL;
|
||||
return (EOF);
|
||||
}
|
||||
if (ltest && offset > LONG_MAX) {
|
||||
errno = EOVERFLOW;
|
||||
return (EOF);
|
||||
}
|
||||
whence = SEEK_SET;
|
||||
havepos = 1;
|
||||
break;
|
||||
@ -219,6 +223,10 @@ _fseeko(fp, offset, whence, ltest)
|
||||
errno = EINVAL;
|
||||
return (EOF);
|
||||
}
|
||||
if (ltest && (off_t)target > LONG_MAX) {
|
||||
errno = EOVERFLOW;
|
||||
return (EOF);
|
||||
}
|
||||
}
|
||||
|
||||
if (!havepos) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user