diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-08-14 22:16:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-08-14 22:16:14 +0000 |
commit | 107b8a922a9f72bae8d066549c675062bee0897f (patch) | |
tree | fd03a2fabf180e1abd1cfaef284447bdf63cad6f /libio/memstream.c | |
parent | * libio/wstrops.c: Remove dead macro definitions and comments. (diff) | |
download | glibc-107b8a922a9f72bae8d066549c675062bee0897f.tar.gz glibc-107b8a922a9f72bae8d066549c675062bee0897f.tar.bz2 glibc-107b8a922a9f72bae8d066549c675062bee0897f.zip |
[BZ #1996]
2006-08-14 Ulrich Drepper <drepper@redhat.com>
[BZ #1996]
* libio/memstream.c (open_memstream): Allocate initial buffer with
calloc.
* libio/wmemstream.c (open_wmemstream): Likewise.
* libio/strops.c: Pretty printing.
(_IO_str_overflow): Clear uninitialized part of the new buffer.
(enlarge_userbuf): New function.
(_IO_str_seekoff): Call it if seek position is larger than current
buffer.
* libio/wstrops.c: Likewise.
* libio/vasprintf.c: Add comment as to why we do not have to use
calloc instead of malloc to allocate initial buffer.
* libio/Makefile (tests): Add bug-memstream1 and bug-wmemstream1.
* libio/bug-memstream1.c: New file.
* libio/bug-wmemstream1.c: New file.
Diffstat (limited to 'libio/memstream.c')
-rw-r--r-- | libio/memstream.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libio/memstream.c b/libio/memstream.c index 742da740ef..877383f3a8 100644 --- a/libio/memstream.c +++ b/libio/memstream.c @@ -83,7 +83,7 @@ open_memstream (bufloc, sizeloc) new_f->fp._sf._sbf._f._lock = &new_f->lock; #endif - buf = malloc (_IO_BUFSIZ); + buf = calloc (1, _IO_BUFSIZ); if (buf == NULL) return NULL; INTUSE(_IO_init) (&new_f->fp._sf._sbf._f, 0); |