diff options
author | Ivan A. Melnikov <iv@altlinux.org> | 2018-08-16 09:15:46 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-08-16 09:15:46 +0300 |
commit | 13ddc9049ba934ef57184a655aaa42c095b7dca4 (patch) | |
tree | a861452ec99e7d29f30f559ff917da8d17b89c73 /mh | |
parent | a1cda44425c1e4c8dab9207ce993295e80c2aa9c (diff) | |
download | mailutils-13ddc9049ba934ef57184a655aaa42c095b7dca4.tar.gz mailutils-13ddc9049ba934ef57184a655aaa42c095b7dca4.tar.bz2 |
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 <iv@altlinux.org>
Diffstat (limited to 'mh')
-rw-r--r-- | mh/mh_format.c | 1 |
1 files changed, 1 insertions, 0 deletions
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; |