diff options
Diffstat (limited to 'src/H5Pdxpl.c')
-rw-r--r-- | src/H5Pdxpl.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 5941a19..49fece6 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -80,6 +80,7 @@ done: FUNC_LEAVE_API(ret_value); } + /*------------------------------------------------------------------------- * Function: H5Pget_data_transform * @@ -136,11 +137,9 @@ ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, size_t s len = HDstrlen(pexp); if(expression) { - /* sanity check */ - if(size > len) - size = len; - - HDstrncpy(expression, pexp, size); + HDstrncpy(expression, pexp, MIN(len+1,size)); + if(len >= size) + expression[size-1]='\0'; } ret_value = (ssize_t)len; @@ -155,9 +154,6 @@ done: FUNC_LEAVE_API(ret_value); } - - - /*------------------------------------------------------------------------- * Function: H5Pset_buffer |