summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-06-11 12:54:12 +0000
committerEric Andersen <andersen@codepoet.org>2002-06-11 12:54:12 +0000
commit3ec9b390db1a6d1264c32dfae8db53f208c26397 (patch)
treecea8dbbe83af9f77f43ffdbdf54361440c89f796 /libc/stdio
parente26a5970cadb10b06977ddb5928c36d8b1be1367 (diff)
This patch from Rik Faith <faith@alephnull.com> fixes a potentially
non-NULL terminated string problem that could result from the use of open_memstream(). Manuel may have a better solution, but this one works for me, since with this plus the popen fix I can now run things like gdb properly. Thanks Rik!
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/printf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 92b5b5956..e311a4f87 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -1451,6 +1451,7 @@ 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);