diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-02 19:10:10 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-02 19:10:10 +0000 |
| commit | 924888f977ae2a2b4025a530e2b63d0b8a62e758 (patch) | |
| tree | be15c0be354e09f766522b411a1ad2af5d566a99 /lib/libc/stdio/refill.c | |
| parent | 9c552a1fd7aa383ebd2d1e6fcb549fe07162074d (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/refill.c')
| -rw-r--r-- | lib/libc/stdio/refill.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/stdio/refill.c b/lib/libc/stdio/refill.c index fa46d7882a41..2d30e81919d4 100644 --- a/lib/libc/stdio/refill.c +++ b/lib/libc/stdio/refill.c @@ -44,6 +44,7 @@ static const char rcsid[] = #include "namespace.h" #include <errno.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include "un-namespace.h" @@ -141,10 +142,18 @@ __srefill(FILE *fp) if (fp->_r == 0) fp->_flags |= __SEOF; else { + err: fp->_r = 0; fp->_flags |= __SERR; + fp->_flags &= ~__SOFF; } return (EOF); + } else if (fp->_flags & __SOFF) { + if (fp->_offset > OFF_MAX - fp->_r) { + errno = EOVERFLOW; + goto err; + } else + fp->_offset += fp->_r; } return (0); } |
