mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
[svn-r23889] Description:
Merge changes from Coverity branch to trunk: r20768: Switch to snprintf, HDstrncat, HDstrncpy to address coverity issue 832. r20812: Use HDstrncpy. --gh Tested on: Mac OSX/64 10.8.4 (amazon) w/debug Linux/32 2.4 (jam) w/debug
This commit is contained in:
parent
ba44b1ae08
commit
25fe312b3c
@ -183,7 +183,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
|
|||||||
else
|
else
|
||||||
filter->name = filter->_name;
|
filter->name = filter->_name;
|
||||||
|
|
||||||
HDstrcpy(filter->name, (const char *)p);
|
HDstrncpy(filter->name, (const char *)p, actual_name_length);
|
||||||
p += name_length;
|
p += name_length;
|
||||||
} /* end if */
|
} /* 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 */
|
/* Allocate space for the filter name, or use the internal buffer */
|
||||||
if(namelen > H5Z_COMMON_NAME_LEN) {
|
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)
|
if(NULL == dst->filter[i].name)
|
||||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter 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 */
|
} /* end if */
|
||||||
else
|
else
|
||||||
dst->filter[i].name = dst->filter[i]._name;
|
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 */
|
} /* end else */
|
||||||
|
|
||||||
ret_value += 2 + /*filter identification number */
|
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 + /*flags */
|
||||||
2 + /*number of client data values */
|
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 */
|
(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++) {
|
for(i = 0; i < pline->nused; i++) {
|
||||||
char name[32];
|
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\n", indent, "", fwidth, name);
|
||||||
HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3),
|
HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||||
"Filter identification:",
|
"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++) {
|
for(j = 0; j < pline->filter[i].cd_nelmts; j++) {
|
||||||
char field_name[32];
|
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),
|
HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6),
|
||||||
field_name,
|
field_name,
|
||||||
pline->filter[i].cd_values[j]);
|
pline->filter[i].cd_values[j]);
|
||||||
|
151
src/H5system.c
151
src/H5system.c
@ -114,6 +114,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
|
|||||||
char modifier[8];
|
char modifier[8];
|
||||||
int conv;
|
int conv;
|
||||||
char *rest, format_templ[128];
|
char *rest, format_templ[128];
|
||||||
|
int len;
|
||||||
const char *s;
|
const char *s;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
|
|||||||
s = fmt + 1;
|
s = fmt + 1;
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
while(HDstrchr ("-+ #", *s)) {
|
while(HDstrchr("-+ #", *s)) {
|
||||||
switch(*s) {
|
switch(*s) {
|
||||||
case '-':
|
case '-':
|
||||||
leftjust = 1;
|
leftjust = 1;
|
||||||
@ -155,6 +156,9 @@ HDfprintf(FILE *stream, const char *fmt, ...)
|
|||||||
case '#':
|
case '#':
|
||||||
prefix = 1;
|
prefix = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
HDassert(0 && "Unknown format flag");
|
||||||
} /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */
|
} /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */
|
||||||
s++;
|
s++;
|
||||||
} /* end while */
|
} /* end while */
|
||||||
@ -243,16 +247,17 @@ HDfprintf(FILE *stream, const char *fmt, ...)
|
|||||||
conv = *s++;
|
conv = *s++;
|
||||||
|
|
||||||
/* Create the format template */
|
/* Create the format template */
|
||||||
sprintf(format_templ, "%%%s%s%s%s%s", (leftjust ? "-" : ""),
|
len = 0;
|
||||||
|
len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""),
|
||||||
(plussign ? "+" : ""), (ldspace ? " " : ""),
|
(plussign ? "+" : ""), (ldspace ? " " : ""),
|
||||||
(prefix ? "#" : ""), (zerofill ? "0" : ""));
|
(prefix ? "#" : ""), (zerofill ? "0" : ""));
|
||||||
if(fwidth > 0)
|
if(fwidth > 0)
|
||||||
sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
|
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth);
|
||||||
if(prec > 0)
|
if(prec > 0)
|
||||||
sprintf(format_templ+HDstrlen(format_templ), ".%d", prec);
|
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec);
|
||||||
if(*modifier)
|
if(*modifier)
|
||||||
sprintf(format_templ+HDstrlen(format_templ), "%s", modifier);
|
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier);
|
||||||
sprintf (format_templ+HDstrlen(format_templ), "%c", conv);
|
HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv);
|
||||||
|
|
||||||
|
|
||||||
/* Conversion */
|
/* Conversion */
|
||||||
@ -324,31 +329,42 @@ HDfprintf(FILE *stream, const char *fmt, ...)
|
|||||||
haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
|
haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
|
||||||
|
|
||||||
if(H5F_addr_defined(x)) {
|
if(H5F_addr_defined(x)) {
|
||||||
sprintf(format_templ, "%%%s%s%s%s%s",
|
len = 0;
|
||||||
|
len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s",
|
||||||
(leftjust ? "-" : ""), (plussign ? "+" : ""),
|
(leftjust ? "-" : ""), (plussign ? "+" : ""),
|
||||||
(ldspace ? " " : ""), (prefix ? "#" : ""),
|
(ldspace ? " " : ""), (prefix ? "#" : ""),
|
||||||
(zerofill ? "0" : ""));
|
(zerofill ? "0" : ""));
|
||||||
if(fwidth > 0)
|
if(fwidth > 0)
|
||||||
sprintf(format_templ + HDstrlen(format_templ), "%d", fwidth);
|
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth);
|
||||||
|
|
||||||
/*lint --e{506} Don't issue warnings about constant value booleans */
|
/*lint --e{506} Don't issue warnings about constant value booleans */
|
||||||
/*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
|
/*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */
|
||||||
if(sizeof(x) == H5_SIZEOF_INT)
|
if(sizeof(x) == H5_SIZEOF_INT) {
|
||||||
HDstrcat(format_templ, "u");
|
HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
else if(sizeof(x) == H5_SIZEOF_LONG)
|
len++;
|
||||||
HDstrcat(format_templ, "lu");
|
} /* end if */
|
||||||
|
else if(sizeof(x) == H5_SIZEOF_LONG) {
|
||||||
|
HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
|
len++;
|
||||||
|
} /* end if */
|
||||||
else if(sizeof(x) == H5_SIZEOF_LONG_LONG) {
|
else if(sizeof(x) == H5_SIZEOF_LONG_LONG) {
|
||||||
HDstrcat(format_templ, H5_PRINTF_LL_WIDTH);
|
HDstrncat(format_templ, H5_PRINTF_LL_WIDTH, (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
HDstrcat(format_templ, "u");
|
len += (int)sizeof(H5_PRINTF_LL_WIDTH);
|
||||||
|
HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
|
len++;
|
||||||
}
|
}
|
||||||
n = fprintf(stream, format_templ, x);
|
n = fprintf(stream, format_templ, x);
|
||||||
} else {
|
} else {
|
||||||
HDstrcpy(format_templ, "%");
|
len = 0;
|
||||||
if(leftjust)
|
HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
HDstrcat(format_templ, "-");
|
len++;
|
||||||
|
if(leftjust) {
|
||||||
|
HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
|
len++;
|
||||||
|
} /* end if */
|
||||||
if(fwidth)
|
if(fwidth)
|
||||||
sprintf(format_templ+HDstrlen(format_templ), "%d", fwidth);
|
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth);
|
||||||
HDstrcat(format_templ, "s");
|
HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1)));
|
||||||
fprintf(stream, format_templ, "UNDEF");
|
fprintf(stream, format_templ, "UNDEF");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -457,8 +473,9 @@ HDstrtoll(const char *s, const char **rest, int base)
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (!s || (base && (base<2 || base>36))) {
|
if (!s || (base && (base<2 || base>36))) {
|
||||||
if (rest) *rest = s;
|
if (rest)
|
||||||
return 0;
|
*rest = s;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip white space */
|
/* Skip white space */
|
||||||
@ -466,21 +483,21 @@ HDstrtoll(const char *s, const char **rest, int base)
|
|||||||
|
|
||||||
/* Optional minus or plus sign */
|
/* Optional minus or plus sign */
|
||||||
if ('+'==*s) {
|
if ('+'==*s) {
|
||||||
s++;
|
s++;
|
||||||
} else if ('-'==*s) {
|
} else if ('-'==*s) {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero base prefix */
|
/* Zero base prefix */
|
||||||
if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) {
|
if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) {
|
||||||
base = 16;
|
base = 16;
|
||||||
s += 2;
|
s += 2;
|
||||||
} else if (0==base && '0'==*s) {
|
} else if (0==base && '0'==*s) {
|
||||||
base = 8;
|
base = 8;
|
||||||
s++;
|
s++;
|
||||||
} else if (0==base) {
|
} else if (0==base) {
|
||||||
base = 10;
|
base = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Digits */
|
/* Digits */
|
||||||
@ -488,34 +505,39 @@ HDstrtoll(const char *s, const char **rest, int base)
|
|||||||
(base>10 && ((*s>='0' && *s<='9') ||
|
(base>10 && ((*s>='0' && *s<='9') ||
|
||||||
(*s>='a' && *s<'a'+base-10) ||
|
(*s>='a' && *s<'a'+base-10) ||
|
||||||
(*s>='A' && *s<'A'+base-10)))) {
|
(*s>='A' && *s<'A'+base-10)))) {
|
||||||
if (!overflow) {
|
if (!overflow) {
|
||||||
int64_t digit = 0;
|
int64_t digit = 0;
|
||||||
if (*s>='0' && *s<='9') digit = *s - '0';
|
|
||||||
else if (*s>='a' && *s<='z') digit = (*s-'a')+10;
|
|
||||||
else digit = (*s-'A')+10;
|
|
||||||
|
|
||||||
if (acc*base+digit < acc) {
|
if (*s>='0' && *s<='9')
|
||||||
overflow = TRUE;
|
digit = *s - '0';
|
||||||
} else {
|
else if (*s>='a' && *s<='z')
|
||||||
acc = acc*base + digit;
|
digit = (*s-'a')+10;
|
||||||
}
|
else
|
||||||
}
|
digit = (*s-'A')+10;
|
||||||
s++;
|
|
||||||
|
if (acc*base+digit < acc) {
|
||||||
|
overflow = TRUE;
|
||||||
|
} else {
|
||||||
|
acc = acc*base + digit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overflow */
|
/* Overflow */
|
||||||
if (overflow) {
|
if (overflow) {
|
||||||
if (sign>0) {
|
if (sign>0) {
|
||||||
acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1;
|
acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1;
|
||||||
} else {
|
} else {
|
||||||
acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1));
|
acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1));
|
||||||
}
|
}
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return values */
|
/* Return values */
|
||||||
acc *= sign;
|
acc *= sign;
|
||||||
if (rest) *rest = s;
|
if (rest)
|
||||||
|
*rest = s;
|
||||||
return acc;
|
return acc;
|
||||||
} /* end HDstrtoll() */
|
} /* end HDstrtoll() */
|
||||||
|
|
||||||
@ -576,12 +598,13 @@ int
|
|||||||
HDremove_all(const char *fname)
|
HDremove_all(const char *fname)
|
||||||
{
|
{
|
||||||
int ret_value = -1;
|
int ret_value = -1;
|
||||||
|
size_t fname_len;
|
||||||
char *_fname;
|
char *_fname;
|
||||||
|
|
||||||
_fname = (char *)H5MM_malloc(HDstrlen(fname) + 3); /* to accomodate ;* and null */
|
fname_len = HDstrlen(fname) + 3; /* to accomodate ";*" and null terminator */
|
||||||
|
_fname = (char *)H5MM_malloc(fname_len);
|
||||||
if(_fname) {
|
if(_fname) {
|
||||||
HDstrcpy(_fname, fname);
|
HDsnprintf(_fname, fname_len, "%s;*", fname);
|
||||||
HDstrcat(_fname,";*");
|
|
||||||
/* Do not use HDremove; function becomes recursive (see H5private.h file)*/
|
/* Do not use HDremove; function becomes recursive (see H5private.h file)*/
|
||||||
remove(_fname);
|
remove(_fname);
|
||||||
H5MM_xfree(_fname);
|
H5MM_xfree(_fname);
|
||||||
@ -723,6 +746,10 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
|
|
||||||
FUNC_ENTER_NOAPI_NOINIT
|
FUNC_ENTER_NOAPI_NOINIT
|
||||||
|
|
||||||
|
/* Sanity check */
|
||||||
|
HDassert(name);
|
||||||
|
HDassert(extpath);
|
||||||
|
|
||||||
/* Clear external path pointer to begin with */
|
/* Clear external path pointer to begin with */
|
||||||
*extpath = NULL;
|
*extpath = NULL;
|
||||||
|
|
||||||
@ -738,11 +765,13 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
} /* end if */
|
} /* end if */
|
||||||
else { /* relative pathname */
|
else { /* relative pathname */
|
||||||
char *retcwd;
|
char *retcwd;
|
||||||
|
size_t name_len;
|
||||||
int drive;
|
int drive;
|
||||||
|
|
||||||
if(NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN)))
|
if(NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN)))
|
||||||
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||||
if(NULL == (new_name = (char *)H5MM_strdup(name)))
|
name_len = HDstrlen(name) + 1;
|
||||||
|
if(NULL == (new_name = (char *)H5MM_malloc(name_len)))
|
||||||
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -754,7 +783,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
if(H5_CHECK_ABS_DRIVE(name)) {
|
if(H5_CHECK_ABS_DRIVE(name)) {
|
||||||
drive = name[0] - 'A' + 1;
|
drive = name[0] - 'A' + 1;
|
||||||
retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN);
|
retcwd = HDgetdcwd(drive, cwdpath, MAX_PATH_LEN);
|
||||||
HDstrcpy(new_name, &name[2]);
|
HDstrncpy(new_name, &name[2], name_len);
|
||||||
} /* end if */
|
} /* end if */
|
||||||
/*
|
/*
|
||||||
* Windows: name[0] is a '/' or '\'
|
* Windows: name[0] is a '/' or '\'
|
||||||
@ -763,20 +792,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
* OpenVMS: does not apply
|
* OpenVMS: does not apply
|
||||||
*/
|
*/
|
||||||
else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) {
|
else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) {
|
||||||
sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]);
|
HDsnprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]);
|
||||||
retcwd = cwdpath;
|
retcwd = cwdpath;
|
||||||
HDstrcpy(new_name, &name[1]);
|
HDstrncpy(new_name, &name[1], name_len);
|
||||||
}
|
}
|
||||||
/* totally relative for Unix, Windows, and OpenVMS: get current working directory */
|
/* totally relative for Unix, Windows, and OpenVMS: get current working directory */
|
||||||
else
|
else {
|
||||||
retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN);
|
retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN);
|
||||||
|
HDstrncpy(new_name, name, name_len);
|
||||||
|
} /* end if */
|
||||||
|
|
||||||
if(retcwd != NULL) {
|
if(retcwd != NULL) {
|
||||||
size_t cwdlen;
|
size_t cwdlen;
|
||||||
size_t path_len;
|
size_t path_len;
|
||||||
|
|
||||||
|
HDassert(cwdpath);
|
||||||
cwdlen = HDstrlen(cwdpath);
|
cwdlen = HDstrlen(cwdpath);
|
||||||
HDassert(cwdlen);
|
HDassert(cwdlen);
|
||||||
|
HDassert(new_name);
|
||||||
path_len = cwdlen + HDstrlen(new_name) + 2;
|
path_len = cwdlen + HDstrlen(new_name) + 2;
|
||||||
if(NULL == (full_path = (char *)H5MM_malloc(path_len)))
|
if(NULL == (full_path = (char *)H5MM_malloc(path_len)))
|
||||||
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||||
@ -793,7 +826,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
char *tmp = new_name;
|
char *tmp = new_name;
|
||||||
|
|
||||||
full_path[cwdlen - 1] = '\0';
|
full_path[cwdlen - 1] = '\0';
|
||||||
HDstrcat(full_path, ++tmp);
|
HDstrncat(full_path, ++tmp, HDstrlen(tmp));
|
||||||
} /* end if */
|
} /* end if */
|
||||||
else
|
else
|
||||||
HDstrncat(full_path, new_name, HDstrlen(new_name));
|
HDstrncat(full_path, new_name, HDstrlen(new_name));
|
||||||
@ -818,9 +851,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
|
|||||||
done:
|
done:
|
||||||
/* Release resources */
|
/* Release resources */
|
||||||
if(cwdpath)
|
if(cwdpath)
|
||||||
H5MM_xfree(cwdpath);
|
H5MM_xfree(cwdpath);
|
||||||
if(new_name)
|
if(new_name)
|
||||||
H5MM_xfree(new_name);
|
H5MM_xfree(new_name);
|
||||||
|
|
||||||
FUNC_LEAVE_NOAPI(ret_value)
|
FUNC_LEAVE_NOAPI(ret_value)
|
||||||
} /* H5_build_extpath() */
|
} /* H5_build_extpath() */
|
||||||
|
Loading…
Reference in New Issue
Block a user