From 3ec9b390db1a6d1264c32dfae8db53f208c26397 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 11 Jun 2002 12:54:12 +0000 Subject: This patch from Rik Faith 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! --- libc/stdio/printf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc/stdio/printf.c') 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); -- cgit v1.2.3