mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[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.]
This commit is contained in:
parent
704300d992
commit
693131fe40
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user