summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2001-03-14 19:14:13 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2001-03-14 19:14:13 (GMT)
commit693131fe40f5c4c014abc590be01bacb9ccdedb7 (patch)
tree3f3c0837ac09f71212b9137dae78dab0eb602694 /tools
parent704300d992d9853d31ecdb87c0c5ed62f948af33 (diff)
downloadhdf5-693131fe40f5c4c014abc590be01bacb9ccdedb7.zip
hdf5-693131fe40f5c4c014abc590be01bacb9ccdedb7.tar.gz
hdf5-693131fe40f5c4c014abc590be01bacb9ccdedb7.tar.bz2
[svn-r3632]
Purpose: a bug fix on windows(possible on other platforms) Description: not allocating enough space for a string at dump_all for debug version a string tmp is defined at dump_all(....), The memory that is allocated to tmp is malloc(strlen(prefix)+strlen(name)+1); However, there is one testing case : strlen(prefix) is 0 and tmp is allocated in the following: strcat(tmp,"/"); strcat(tmp,name); .... free(tmp); the program fails when freeing tmp for debug (dll) version on windows 2000 Solution: For windows platform: allocate memory strlen(prefix)+strlen(name)+2 Platforms tested: [machines you have tested the changed version. This is absolute important. Test it out on at least two or three different platforms such as Big-endian-32bit (SUN/IRIX), little-endian-32(LINUX) and 64-bit (IRIX64/UNICOS/DEC-ALPHA) would be good.]
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0c87b17..c24b2d4 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1274,8 +1274,11 @@ dump_all(hid_t group, const char *name, void * op_data)
if (*(int *)op_data != H5G_UNKNOWN && statbuf.type != *(int *) op_data)
goto done;
-
+#ifdef WIN32
+ tmp = malloc(strlen(prefix)+strlen(name)+2);
+#else
tmp = malloc(strlen(prefix) + strlen(name) + 1);
+#endif
strcpy(tmp, prefix);
switch (statbuf.type) {