diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-02-07 21:23:22 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-02-07 21:23:22 (GMT) |
commit | 6b1297a1ba07a06acc22f76614278000896f94dd (patch) | |
tree | f262d71801787a34e17d822fe3202309e35e6d7f /tools | |
parent | d4708e35ab8b2fba8552d6b9123df8b6e8d8b39c (diff) | |
download | hdf5-6b1297a1ba07a06acc22f76614278000896f94dd.zip hdf5-6b1297a1ba07a06acc22f76614278000896f94dd.tar.gz hdf5-6b1297a1ba07a06acc22f76614278000896f94dd.tar.bz2 |
[svn-r20060] Missing null character on return of get_comment - force \0
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5dump/h5dump.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 5ab96ac..6b1f576 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2651,14 +2651,14 @@ dump_comment(hid_t obj_id) cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); - /* if the actual length of the comment is longer than cmt_bufsize, then call - * H5Oget_comment again with the correct value. + /* call H5Oget_comment again with the correct value. * If the call to H5Oget_comment returned an error, skip this block */ if (cmt_bufsize > 0) { comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */ if(comment) { cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); if(cmt_bufsize > 0) { + comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ indentation(indent); printf("COMMENT \"%s\"\n", comment); } /* end if */ |