From 405550bf78acc8ce8885e4b30986035533d08267 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 24 Jul 2002 10:44:53 +0000 Subject: Update. 2002-07-24 Ulrich Drepper * locale/hashval.h: Make more self-containedby defining LONG_BITS. * locale/programs/simple-hash.c: Remove LONG_BITS definition. * locale/programs/locarchive.c (add_locale_to_archive): Correct test to detect duplicate locales. * libio/fileops.c (_IO_new_file_seekoff): Fail if relative position would be before beginning of file. (_IO_file_seekoff_mmap): Likewise. * libio/Makefile (tests): Add bug-fseek. * libio/bug-fseek.c: New file. * intl/explodename.c: Remove support for CEN-style locale variables. It was never used and shouldn't be since it's not portable. * intl/finddomain.c: Likewise. * intl/l10nflist.c: Likewise. * intl/loadinfo.h: Likewise. * locale/findlocale.c: Likewise. --- libio/fileops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libio/fileops.c') diff --git a/libio/fileops.c b/libio/fileops.c index fa4c8e0fa8..1794dce57f 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -778,6 +778,11 @@ _IO_new_file_seekoff (fp, offset, dir, mode) goto dumb; /* Make offset absolute, assuming current pointer is file_ptr(). */ offset += fp->_offset; + if (offset < 0) + { + __set_errno (EINVAL); + return EOF; + } dir = _IO_seek_set; break; @@ -934,6 +939,11 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode) case _IO_seek_cur: /* Adjust for read-ahead (bytes is buffer). */ offset += fp->_IO_read_ptr - fp->_IO_read_base; + if (offset < 0) + { + __set_errno (EINVAL); + return EOF; + } break; case _IO_seek_set: break; -- cgit 1.4.1