diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-16 04:44:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-16 04:44:13 (GMT) |
commit | 164b4c75341ee4aa31dcd47c189e415a36ae35e2 (patch) | |
tree | 121120c9d2df2d601730e4c371afbf5f82004f92 /test/H5srcdir.h | |
parent | 288c7760a4a55d56df7a9019a8522625e305b9b7 (diff) | |
download | hdf5-164b4c75341ee4aa31dcd47c189e415a36ae35e2.zip hdf5-164b4c75341ee4aa31dcd47c189e415a36ae35e2.tar.gz hdf5-164b4c75341ee4aa31dcd47c189e415a36ae35e2.tar.bz2 |
[svn-r24804] Description:
Brought changes from Coverity branch back to trunk, and cleaned up misc.
other warnings & formatting issues:
r20833:
Fixed Coverity 667 and 668 with real integer overflow tests this time.
r20834:
Use HDstrncpy and HDstrncat. --gh
r20835:
Change to use strncpy - use base_len + 1 for line 156, use HDstrlen(path) + 1 for line 159
r20836:
Fixed coverity 585 by casting output of fgetc() to a char.
r20837:
Changed sprintf calls to snprintf with size 1 less than the allocated buffer to address coverity issue #967.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/C++, FORTRAN & parallel
(too minor to require h5committest)
Diffstat (limited to 'test/H5srcdir.h')
-rw-r--r-- | test/H5srcdir.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/H5srcdir.h b/test/H5srcdir.h index 202d050..4f0f439 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -46,8 +46,8 @@ static const char *H5_get_srcdir_filename(const char *filename) /* Build path to test file */ if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) { - HDstrcpy(srcdir_testpath, srcdir); #ifdef H5_VMS + HDstrcpy(srcdir_testpath, srcdir); if(filename[0] == '[') { char *tmp = filename; @@ -57,8 +57,7 @@ static const char *H5_get_srcdir_filename(const char *filename) else HDstrcat(srcdir_testpath, filename); #else - HDstrcat(srcdir_testpath, "/"); - HDstrcat(srcdir_testpath, filename); + HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); #endif return(srcdir_testpath); } /* end if */ @@ -77,8 +76,7 @@ static const char *H5_get_srcdir(void) /* Build path to all test files */ if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) { - HDstrcpy(srcdir_path, srcdir); - HDstrcat(srcdir_path, "/"); + HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); return(srcdir_path); } /* end if */ else |