Pass buffer size to VG_(elapsed_wallclock_time) so the function
can check it's large enough.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14724 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 549e7d7..1325856 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -424,10 +424,12 @@
millisecond timer having been set to zero by an initial read in
m_main during startup. */
-void VG_(elapsed_wallclock_time) ( /*OUT*/HChar* buf )
+void VG_(elapsed_wallclock_time) ( /*OUT*/HChar* buf, SizeT bufsize )
{
UInt t, ms, s, mins, hours, days;
+ vg_assert(bufsize > 20);
+
t = VG_(read_millisecond_timer)(); /* milliseconds */
ms = t % 1000;
@@ -534,9 +536,7 @@
b->buf[b->buf_used++] = ch;
if (VG_(clo_time_stamp)) {
- VG_(memset)(tmp, 0, sizeof(tmp));
- VG_(elapsed_wallclock_time)(tmp);
- tmp[sizeof(tmp)-1] = 0;
+ VG_(elapsed_wallclock_time)(tmp, sizeof tmp);
for (i = 0; tmp[i]; i++)
b->buf[b->buf_used++] = tmp[i];
}