From 965258b00826481f6ca7b3d18709eb46734fe6fa Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 19 Jun 2011 09:43:45 -0500 Subject: [svn-r20997] Get comment section did not add null terminator. Tested: Debug windows --- tools/h5ls/h5ls.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 722f45c..a00a9e1 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -846,15 +846,15 @@ display_enum_type(hid_t type, int ind) for (j=0; j 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, comment, cmt_bufsize); if(cmt_bufsize > 0) { + comment[cmt_bufsize] = 0; printf(" %-10s \"", "Comment:"); display_string(stdout, comment, FALSE); puts("\""); -- cgit v0.12