summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-06-19 14:38:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-06-19 14:38:52 (GMT)
commit10566235231a65ec255748720f7b089db1280c46 (patch)
treef0894a78fd7fe0e1b96f5ca03d10e0152c053e8a /tools
parentd25ff865eeb6ee4c4396b9e174a322cc359e0fbd (diff)
downloadhdf5-10566235231a65ec255748720f7b089db1280c46.zip
hdf5-10566235231a65ec255748720f7b089db1280c46.tar.gz
hdf5-10566235231a65ec255748720f7b089db1280c46.tar.bz2
[svn-r20995] Get comment section did not add null terminator.
Tested: Debug windows
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls/h5ls.c15
1 files 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<dst_size; j++)
printf("%02x", value[i*dst_size+j]);
} else if (H5T_SGN_NONE==H5Tget_sign(native)) {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
HDfprintf(stdout,"%"H5_PRINTF_LL_WIDTH"u",
*((unsigned long long*)((void*)copy)));
} else {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value+i*dst_size;
+ /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
+ *strangely, unless use another pointer "copy".*/
+ copy = value+i*dst_size;
HDfprintf(stdout,"%"H5_PRINTF_LL_WIDTH"d",
*((long long*)((void*)copy)));
}
@@ -1838,10 +1838,11 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
* 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, comment, cmt_bufsize);
if(cmt_bufsize > 0) {
+ comment[cmt_bufsize] = 0;
printf(" %-10s \"", "Comment:");
display_string(stdout, comment, FALSE);
puts("\"");