summaryrefslogtreecommitdiffstats
path: root/src/H5PLpath.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-12-13 23:31:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-12-13 23:31:00 (GMT)
commit247a6afb7e7fb1bc08a31cb7edbbea5f5b44eb93 (patch)
treed1333820e27591777081f167140313091b5afb73 /src/H5PLpath.c
parentafdf3094cc6577bacd004f2cb4b553b63bf503f7 (diff)
downloadhdf5-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 'src/H5PLpath.c')
-rw-r--r--src/H5PLpath.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/H5PLpath.c b/src/H5PLpath.c
index d53007b..04248b5 100644
--- a/src/H5PLpath.c
+++ b/src/H5PLpath.c
@@ -242,6 +242,7 @@ H5PL__create_path_table(void)
* environment variable or the default.
*/
char *next_path = NULL; /* A path tokenized from the paths string */
+ char *lasts = NULL; /* Context pointer for strtok_r() call */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -265,8 +266,7 @@ H5PL__create_path_table(void)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path copy")
/* Separate the paths and store them */
- /* XXX: strtok() is not thread-safe */
- next_path = HDstrtok(paths, H5PL_PATH_SEPARATOR);
+ next_path = HDstrtok_r(paths, H5PL_PATH_SEPARATOR, &lasts);
while (next_path) {
/* Insert the path into the table */
@@ -274,7 +274,7 @@ H5PL__create_path_table(void)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't insert path: %s", next_path)
/* Get the next path from the environment string */
- next_path = HDstrtok(NULL, H5PL_PATH_SEPARATOR);
+ next_path = HDstrtok_r(NULL, H5PL_PATH_SEPARATOR, &lasts);
} /* end while */
done:
@@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)
@@ -755,7 +755,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
continue;
/* attempt to open the dynamic library as a filter library */
- if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0)
+ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed")
if (*found)
HGOTO_DONE(SUCCEED)