diff options
Diffstat (limited to 'main/spprintf.c')
-rw-r--r-- | main/spprintf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/spprintf.c b/main/spprintf.c index 1bda78d1c6..fcef72b564 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -627,7 +627,10 @@ PHPAPI int vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap cc = xbuf_format_converter(&xbuf, format, ap); if (xbuf.nextb <= xbuf.buf_end) *(xbuf.nextb) = '\0'; - *pbuf = xbuf.buf; + else if (xbuf.size) + xbuf.buf[xbuf.size-1] = '\0'; + if (pbuf) + *pbuf = xbuf.buf; return cc; } } |