summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-10-27 02:12:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-10-27 02:12:02 (GMT)
commitc274ffe1c9bdfa256459213cab1ece7f566b9620 (patch)
treea08fa12cc07b4b8f8471bbcfd8d94e34a82d03c5 /test
parenta75d43be95aa7009b5a20306eedb08c0a734a18e (diff)
downloadhdf5-c274ffe1c9bdfa256459213cab1ece7f566b9620.zip
hdf5-c274ffe1c9bdfa256459213cab1ece7f566b9620.tar.gz
hdf5-c274ffe1c9bdfa256459213cab1ece7f566b9620.tar.bz2
[svn-r9466] Purpose:
Bug fix Description: Clean up potential buffer overflow in strncpy() Platforms tested: FreeBSD 4.10 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'test')
-rw-r--r--test/dtransform.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/dtransform.c b/test/dtransform.c
index da8b95c..622545d 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -654,13 +654,13 @@ int test_getset(const hid_t dxpl_id_c_to_f)
const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
const char* c_to_f = "(9/5.0)*x + 32";
- char* ptrgetTest = malloc(strlen(c_to_f)+1);
+ char* ptrgetTest = HDmalloc(HDstrlen(c_to_f)+1);
- memset(ptrgetTest, 0, strlen(c_to_f)+1);
+ HDmemset(ptrgetTest, 0, HDstrlen(c_to_f)+1);
TESTING("H5Pget_data_transform")
- H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, strlen(c_to_f));
- if(strcmp(c_to_f, ptrgetTest) != 0)
+ H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f)+1);
+ if(HDstrcmp(c_to_f, ptrgetTest) != 0)
{
H5_FAILED();
fprintf(stderr, " ERROR: Data transform failed to match what was set\n");
@@ -690,12 +690,12 @@ int test_getset(const hid_t dxpl_id_c_to_f)
}
PASSED();
- memset(ptrgetTest, 0, strlen(c_to_f)+1);
+ HDmemset(ptrgetTest, 0, strlen(c_to_f)+1);
free(ptrgetTest);
ptrgetTest = malloc(strlen(simple)+1);
- memset(ptrgetTest, 0, strlen(simple)+1);
+ HDmemset(ptrgetTest, 0, strlen(simple)+1);
TESTING("H5Pget_data_transform, after resetting transform property")
H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, strlen(simple)+1);
if(strcmp(simple, ptrgetTest) != 0)