summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-03-09 15:49:46 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-03-09 15:49:46 (GMT)
commit2a492f23a1bfc25169dc6f063afaf6dd20d0e749 (patch)
tree3698db83f2de0a162d55f16c6e810822089c854f
parentd97523f47ce7ef7cbb92f31902f88eb43b51d2cb (diff)
downloadhdf5-2a492f23a1bfc25169dc6f063afaf6dd20d0e749.zip
hdf5-2a492f23a1bfc25169dc6f063afaf6dd20d0e749.tar.gz
hdf5-2a492f23a1bfc25169dc6f063afaf6dd20d0e749.tar.bz2
[svn-r20211] Valgrind indicated error in writing past buffer. Contary to ref man H5O_get_comment does not return null char in size.
Tested: local linux and valgrind
-rw-r--r--tools/h5dump/h5dump.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 81a6793..bebc892 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2660,7 +2660,7 @@ dump_comment(hid_t obj_id)
/* 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 */
+ 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) {