diff options
author | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2016-03-21 20:13:51 (GMT) |
---|---|---|
committer | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2016-11-29 23:42:32 (GMT) |
commit | f4ab6ec3a5bc5b4985b30c250d62fb860c291a96 (patch) | |
tree | e2405faec082ecde364d9809f0c6454b2767f88c /src | |
parent | da0243af3e3a23fbbf36096e6c672d66c932d31c (diff) | |
download | hdf5-f4ab6ec3a5bc5b4985b30c250d62fb860c291a96.zip hdf5-f4ab6ec3a5bc5b4985b30c250d62fb860c291a96.tar.gz hdf5-f4ab6ec3a5bc5b4985b30c250d62fb860c291a96.tar.bz2 |
Fix size returned from H5Rget_obj/attr/filename when buf is NULL
Diffstat (limited to 'src')
-rw-r--r-- | src/H5R.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1745,10 +1745,11 @@ H5R__get_obj_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, href_t _ref, /* Get the path name length */ UINT16DECODE(p, pathname_len); - copy_len = MIN(pathname_len, size - 1); + copy_len = pathname_len; /* Get the path name */ if (name) { + copy_len = MIN(copy_len, size - 1); HDmemcpy(name, p, copy_len); name[copy_len] = '\0'; } @@ -1884,10 +1885,11 @@ H5R__get_attr_name(H5F_t *f, href_t _ref, char *name, size_t size) /* Get the attribute name length */ UINT16DECODE(p, attr_name_len); HDassert(attr_name_len < H5R_MAX_ATTR_REF_NAME_LEN); - copy_len = MIN(attr_name_len, size - 1); + copy_len = attr_name_len; /* Get the attribute name */ if (name) { + copy_len = MIN(copy_len, size - 1); HDmemcpy(name, p, copy_len); name[copy_len] = '\0'; } @@ -1969,10 +1971,11 @@ H5R__get_file_name(href_t _ref, char *name, size_t size) /* Get the file name length */ p = (const uint8_t *)ref->ref.serial.buf; UINT16DECODE(p, filename_len); - copy_len = MIN(filename_len, size - 1); + copy_len = filename_len; /* Get the attribute name */ if (name) { + copy_len = MIN(copy_len, size - 1); HDmemcpy(name, p, copy_len); name[copy_len] = '\0'; } |