summaryrefslogtreecommitdiffstats
path: root/src/H5Opline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Opline.c')
-rw-r--r--src/H5Opline.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 1a2baa0..0a0f12a 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -183,7 +183,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
else
filter->name = filter->_name;
- HDstrcpy(filter->name, (const char *)p);
+ HDstrncpy(filter->name, (const char *)p, actual_name_length);
p += name_length;
} /* end if */
@@ -375,12 +375,9 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
/* Allocate space for the filter name, or use the internal buffer */
if(namelen > H5Z_COMMON_NAME_LEN) {
- dst->filter[i].name = (char *)H5MM_malloc(namelen);
+ dst->filter[i].name = (char *)H5MM_strdup(src->filter[i].name);
if(NULL == dst->filter[i].name)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name")
-
- /* Copy name */
- HDstrcpy(dst->filter[i].name, src->filter[i].name);
} /* end if */
else
dst->filter[i].name = dst->filter[i]._name;
@@ -464,7 +461,7 @@ H5O_pline_size(const H5F_t UNUSED *f, const void *mesg)
} /* end else */
ret_value += 2 + /*filter identification number */
- ((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */
+ (size_t)((pline->version == H5O_PLINE_VERSION_1 || pline->filter[i].id >= H5Z_FILTER_RESERVED) ? 2 : 0) + /*name length */
2 + /*flags */
2 + /*number of client data values */
(pline->version == H5O_PLINE_VERSION_1 ? (size_t)H5O_ALIGN_OLD(name_len) : name_len); /*length of the filter name */
@@ -633,7 +630,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s
for(i = 0; i < pline->nused; i++) {
char name[32];
- sprintf(name, "Filter at position %u", (unsigned)i);
+ HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i);
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name);
HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3),
"Filter identification:",
@@ -656,7 +653,7 @@ H5O_pline_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE *s
for(j = 0; j < pline->filter[i].cd_nelmts; j++) {
char field_name[32];
- sprintf(field_name, "CD value %lu", (unsigned long)j);
+ HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j);
HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6),
field_name,
pline->filter[i].cd_values[j]);