commit 51f10424d329aad87136ef8d7fac2cae3ce766df Author: Ivan A. Melnikov Date: Wed Aug 15 16:08:55 2018 +0400 Force terminating \0 in mh_format result Apparently, mu_stream_read is not required to put the terminating zero into the buffer, so we need to do it in its caller. Signed-off-by: Ivan A. Melnikov diff --git a/mh/mh_format.c b/mh/mh_format.c index d4aff7f4d..77faaf030 100644 --- a/mh/mh_format.c +++ b/mh/mh_format.c @@ -726,6 +726,7 @@ mh_format_str (mh_format_t fmt, char *str, size_t width, char **pstr) buf = mu_alloc (size + 1); MU_ASSERT (mu_stream_seek (outstr, 0, MU_SEEK_SET, NULL)); MU_ASSERT (mu_stream_read (outstr, buf, size, NULL)); + buf[size] = 0; *pstr = buf;