diff options
author | Jordan K. Hubbard <jkh@FreeBSD.org> | 2003-07-02 07:08:44 +0000 |
---|---|---|
committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 2003-07-02 07:08:44 +0000 |
commit | b0a06af596dcf12f3a0b0c3c304c7a84a3f71c2c (patch) | |
tree | eab400f0eb82eaf7d37d3fbfda23e1e93ae556e9 | |
parent | f493d09ae7e2d3588750371083fd7b06beb6e2b8 (diff) |
Notes
-rw-r--r-- | lib/libc/stdio/vsnprintf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c index 64798073a70a..16d46eeaae02 100644 --- a/lib/libc/stdio/vsnprintf.c +++ b/lib/libc/stdio/vsnprintf.c @@ -50,7 +50,7 @@ vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt, { size_t on; int ret; - char dummy; + char dummy[2]; FILE f; struct __sFILEX ext; @@ -61,8 +61,10 @@ vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt, n = INT_MAX; /* Stdio internals do not deal correctly with zero length buffer */ if (n == 0) { - str = &dummy; - n = 1; + if (on > 0) + *str = '\0'; + str = dummy; + n = 1; } f._file = -1; f._flags = __SWR | __SSTR; |