summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/printf.c1
-rw-r--r--libc/stdio/stdio.c1
2 files changed, 1 insertions, 1 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index e311a4f87..92b5b5956 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -1451,7 +1451,6 @@ int vasprintf(char **__restrict buf, const char * __restrict format,
return -1;
}
rv = vfprintf(f, format, arg);
- if (rv >= 0) fputc('\0', f);
fclose(f);
if (rv < 0) {
free(*buf);
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;