Fix vassert_fail producing random output for an empty format
vsnprintf does not do any addition to the buffer for an empty
format. So, buf was not null terminated.
This e.g. causes an assert_fail to output random characters
after the failed expression.
Fix by ensuring the buffer of vsnprintf is always null terminated
to start with.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13291 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index b4a6c2b..d4e3bee 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -232,7 +232,8 @@
    b.buf      = buf;
    b.buf_size = size < 0 ? 0 : size;
    b.buf_used = 0;
-
+   if (b.buf_size > 0)
+      b.buf[0] = 0; // ensure to null terminate buf if empty format
    (void) VG_(debugLog_vprintf) 
              ( add_to__snprintf_buf, &b, format, vargs );