mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r14973] Purpose: Fix bug in H5G_get_name_by_addr where buffer size is less than size of name
Description: In the new tests merged from the fortran_1_8 branch, there is a test that fetches a dataset name in a small buffer. The call to H5G_get_name_by_addr wrote an extra byte off the end of the buffer. A simple and sufficient fix is to decrease the buffer size passed to strncmp by 1. This bug was only caught by Visual Studio 2005 with extra debug checks on. Tested: VS2005 on WinXP kagiso
This commit is contained in:
parent
90205aa02c
commit
f9835e1019
@ -1162,7 +1162,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t *
|
||||
|
||||
/* Append the rest of the path */
|
||||
/* (less one character, for the initial path separator) */
|
||||
HDstrncat(name, udata.path, (size - 1));
|
||||
HDstrncat(name, udata.path, (size - 2));
|
||||
if((size_t)ret_value >= size)
|
||||
name[size - 1] = '\0';
|
||||
} /* end if */
|
||||
|
Loading…
Reference in New Issue
Block a user