summaryrefslogtreecommitdiffstats
path: root/src/H5Gname.c
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2008-05-12 18:03:05 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2008-05-12 18:03:05 (GMT)
commitf02082b56859a96ae591fe06c82e619dff4c35c2 (patch)
treef86bb778cf81b39cd881edf17596b79ee53ba82d /src/H5Gname.c
parent7e7e7c7aef2a800cda8fc44daa64fd388416a646 (diff)
downloadhdf5-f02082b56859a96ae591fe06c82e619dff4c35c2.zip
hdf5-f02082b56859a96ae591fe06c82e619dff4c35c2.tar.gz
hdf5-f02082b56859a96ae591fe06c82e619dff4c35c2.tar.bz2
[svn-r14974] 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
Diffstat (limited to 'src/H5Gname.c')
-rw-r--r--src/H5Gname.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/H5Gname.c b/src/H5Gname.c
index bde9e23..f5db1d0 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -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 */