diff options
author | ache <ache@FreeBSD.org> | 2001-08-17 10:22:03 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-08-17 10:22:03 +0000 |
commit | 28f5a912098427ae4056681c966bd87efe71006d (patch) | |
tree | 01e0df89c66a7039f4bf72cb9cdb2e6f51284815 /lib/libc/stdio/fseek.c | |
parent | 555ada99b67bf93e9ebb33f18a3b510f81e11ea3 (diff) | |
download | FreeBSD-src-28f5a912098427ae4056681c966bd87efe71006d.zip FreeBSD-src-28f5a912098427ae4056681c966bd87efe71006d.tar.gz |
Add more overflow checks in case of fseek()
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r-- | lib/libc/stdio/fseek.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index 8dc36e6..5af0bac 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -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) { |