diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-03-09 15:54:01 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-03-09 15:54:01 (GMT) |
commit | 5fa726e066d5fde109022b6f2d03b32ba2e3f236 (patch) | |
tree | 1963800552683a9723f388e716b63f5a9124caa7 | |
parent | 6dd040b2717ff3afc66b9ffebb4cc679533b37b8 (diff) | |
download | hdf5-5fa726e066d5fde109022b6f2d03b32ba2e3f236.zip hdf5-5fa726e066d5fde109022b6f2d03b32ba2e3f236.tar.gz hdf5-5fa726e066d5fde109022b6f2d03b32ba2e3f236.tar.bz2 |
[svn-r20212] Contary to ref man H5O_get_comment does not return null char in size.
Bring r20211 from trunk
-rw-r--r-- | tools/h5dump/h5dump.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 0896c37..9f5cf0c 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2776,10 +2776,11 @@ dump_comment(hid_t obj_id) * 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 */ + comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* 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 */ |