summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-06-11 21:19:41 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-06-11 21:19:41 +0000
commit6af59d0d232e33b2be61a6dc96e7918993dd28d5 (patch)
tree7b2b6409a0b71124ac88ef30636e23bc89dc0958 /libc/stdio/stdio.c
parent3ec9b390db1a6d1264c32dfae8db53f208c26397 (diff)
Revert Erik's patch to vasprintf and fix the real issue.
The writer for the stream returned by open_memstream was supposed to keep the buffer nul-terminated. I apparently left out a statement.
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index 60d4fe73b..1462874f0 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -643,6 +643,7 @@ static ssize_t oms_write(void *cookie, const char *buf, size_t bufsize)
if (COOKIE->pos > COOKIE->eof) {
*COOKIE->sizeloc = COOKIE->eof = COOKIE->pos;
+ COOKIE->buf[COOKIE->eof] = 0; /* Need to nul-terminate. */
}
return bufsize;