summaryrefslogtreecommitdiff
path: root/ext/filepro/filepro.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/filepro/filepro.c')
-rw-r--r--ext/filepro/filepro.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c
index 83a63e8f3e..a9b7ec3064 100644
--- a/ext/filepro/filepro.c
+++ b/ext/filepro/filepro.c
@@ -182,6 +182,7 @@ PHP_FUNCTION(filepro)
FILE *fp;
char workbuf[256]; /* FIX - should really be the max filename length */
char readbuf[256];
+ char *strtok_buf = NULL;
int i;
FP_FIELD *new_field, *tmp;
FP_TLS_VARS;
@@ -221,13 +222,13 @@ PHP_FUNCTION(filepro)
}
/* Get the field count, assume the file is readable! */
- if (strcmp(strtok(readbuf, ":"), "map")) {
+ if (strcmp(strtok_r(readbuf, ":", &strtok_buf), "map")) {
php_error(E_WARNING, "filePro: map file corrupt or encrypted");
RETURN_FALSE;
}
- FP_GLOBAL(fp_keysize) = atoi(strtok(NULL, ":"));
- strtok(NULL, ":");
- FP_GLOBAL(fp_fcount) = atoi(strtok(NULL, ":"));
+ FP_GLOBAL(fp_keysize) = atoi(strtok_r(NULL, ":", &strtok_buf));
+ strtok_r(NULL, ":", &strtok_buf);
+ FP_GLOBAL(fp_fcount) = atoi(strtok_r(NULL, ":", &strtok_buf));
/* Read in the fields themselves */
for (i = 0; i < FP_GLOBAL(fp_fcount); i++) {
@@ -239,9 +240,9 @@ PHP_FUNCTION(filepro)
}
new_field = emalloc(sizeof(FP_FIELD));
new_field->next = NULL;
- new_field->name = estrdup(strtok(readbuf, ":"));
- new_field->width = atoi(strtok(NULL, ":"));
- new_field->format = estrdup(strtok(NULL, ":"));
+ new_field->name = estrdup(strtok_r(readbuf, ":", &strtok_buf));
+ new_field->width = atoi(strtok_r(NULL, ":", &strtok_buf));
+ new_field->format = estrdup(strtok_r(NULL, ":", &strtok_buf));
/* Store in forward-order to save time later */
if (!FP_GLOBAL(fp_fieldlist)) {