diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-12-13 23:31:00 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-12-13 23:31:00 (GMT) |
commit | 247a6afb7e7fb1bc08a31cb7edbbea5f5b44eb93 (patch) | |
tree | d1333820e27591777081f167140313091b5afb73 /test/h5test.c | |
parent | afdf3094cc6577bacd004f2cb4b553b63bf503f7 (diff) | |
download | hdf5-247a6afb7e7fb1bc08a31cb7edbbea5f5b44eb93.zip hdf5-247a6afb7e7fb1bc08a31cb7edbbea5f5b44eb93.tar.gz hdf5-247a6afb7e7fb1bc08a31cb7edbbea5f5b44eb93.tar.bz2 |
Fix plugin code from referencing invalid key ID value, and also switch from
strtok() to strtok_r() to avoid possible interference with / to application
use of strtok().
Diffstat (limited to 'test/h5test.c')
-rw-r--r-- | test/h5test.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/h5test.c b/test/h5test.c index 0805f06..6aad76a 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -855,6 +855,7 @@ h5_get_vfd_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ + char *lasts = NULL; /* Context pointer for strtok_r() call */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ /* Get the environment variable, if it exists */ @@ -877,7 +878,7 @@ h5_get_vfd_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; if(!HDstrcmp(tok, "sec2")) { @@ -936,7 +937,7 @@ h5_get_vfd_fapl(hid_t fapl) hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ /* Was a family size specified in the environment variable? */ - if((tok = HDstrtok(NULL, " \t\n\r"))) + if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) goto error; @@ -945,7 +946,7 @@ h5_get_vfd_fapl(hid_t fapl) unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; /* Were special log file flags specified in the environment variable? */ - if((tok = HDstrtok(NULL, " \t\n\r"))) + if((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) log_flags = (unsigned)HDstrtol(tok, NULL, 0); if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) @@ -990,6 +991,7 @@ h5_get_libver_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ + char *lasts = NULL; /* Context pointer for strtok_r() call */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ /* Get the environment variable, if it exists */ @@ -1012,7 +1014,7 @@ h5_get_libver_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; if(!HDstrcmp(tok, "latest")) { @@ -1053,6 +1055,7 @@ h5_get_vol_fapl(hid_t fapl) { const char *env = NULL; const char *tok = NULL; + char *lasts = NULL; /* Context pointer for strtok_r() call */ htri_t connector_is_registered; char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */ void *vol_info = NULL; /* VOL connector info */ @@ -1075,7 +1078,7 @@ h5_get_vol_fapl(hid_t fapl) */ HDstrncpy(buf, env, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; - if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + if(NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) goto done; /* First, check to see if the connector is already registered */ @@ -1105,7 +1108,7 @@ h5_get_vol_fapl(hid_t fapl) } /* end else */ /* Was there any connector info specified in the environment variable? */ - if(NULL != (tok = HDstrtok(NULL, " \t\n\r"))) + if(NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0) goto error; |