diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-10-20 06:59:57 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-10-20 06:59:57 +0000 |
commit | b7071f6fc41f4c20510de3683f39e5c8ea8a2e1e (patch) | |
tree | 852f4f1992a3c9ecbb44b822df6702c7e635fc5a /libio | |
parent | acfebba27b162b3064c616142883541eaef3f725 (diff) | |
download | glibc-b7071f6fc41f4c20510de3683f39e5c8ea8a2e1e.tar.gz |
Updated to fedora-glibc-20051020T0651
Diffstat (limited to 'libio')
-rw-r--r-- | libio/iogetdelim.c | 10 | ||||
-rw-r--r-- | libio/oldfileops.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c index 3d0c976f9c..a362bf978a 100644 --- a/libio/iogetdelim.c +++ b/libio/iogetdelim.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994,1996,1997,1998,2001,2003 Free Software Foundation, Inc. +/* Copyright (C) 1994,1996-1998,2001,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -45,7 +45,7 @@ _IO_getdelim (lineptr, n, delimiter, fp) int delimiter; _IO_FILE *fp; { - int result; + _IO_ssize_t result; _IO_ssize_t cur_len = 0; _IO_ssize_t len; @@ -91,6 +91,12 @@ _IO_getdelim (lineptr, n, delimiter, fp) t = (char *) memchr ((void *) fp->_IO_read_ptr, delimiter, len); if (t != NULL) len = (t - fp->_IO_read_ptr) + 1; + if (__builtin_expect (cur_len + len + 1 < 0, 0)) + { + __set_errno (EOVERFLOW); + result = -1; + goto unlock_return; + } /* Make enough space for len+1 (for final NUL) bytes. */ needed = cur_len + len + 1; if (needed > *n) diff --git a/libio/oldfileops.c b/libio/oldfileops.c index cd54ea5811..a69c87e8b8 100644 --- a/libio/oldfileops.c +++ b/libio/oldfileops.c @@ -754,7 +754,7 @@ _IO_old_file_xsputn (f, data, n) _IO_size_t block_size, do_write; /* Next flush the (full) buffer. */ if (__overflow (f, EOF) == EOF) - return to_do == 0 ? 0 : n - to_do; + return to_do == 0 ? EOF : n - to_do; /* Try to maintain alignment: write a whole number of blocks. dont_write is what gets left over. */ |