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;
}
/* 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++) {
}
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)) {
ftp_mdtm(ftpbuf_t *ftp, const char *path)
{
time_t stamp;
- struct tm *gmt;
+ struct tm *gmt, tmbuf;
struct tm tm;
char *ptr;
int n;
/* figure out the GMT offset */
stamp = time(NULL);
- gmt = gmtime(&stamp);
+ gmt = gmtime_r(&stamp, &tmbuf);
gmt->tm_isdst = -1;
/* apply the GMT offset */
char *attrname, *str, *temp, language[3];
int i, count;
zval *spec_arr;
+ char *strtok_buf = NULL;
/* Create an array with an entry containing specs for each attribute
and fill in the specs for Title, Description, Keyword, Group.
to the return_value array.
*/
temp = estrdup(objrec);
- attrname = strtok(temp, "\n");
+ attrname = strtok_r(temp, "\n", &strtok_buf);
while(attrname != NULL) {
zval *data, **dataptr;
long spec;
}
}
- attrname = strtok(NULL, "\n");
+ attrname = strtok_r(NULL, "\n", &strtok_buf);
}
if(NULL == sarr){
// spec_arr->refcount--;
int hasDescription = 0;
int hasKeyword = 0;
int hasGroup = 0;
+ char *strtok_buf;
MAKE_STD_ZVAL(title_arr);
MAKE_STD_ZVAL(desc_arr);
/* Fill Array of titles, descriptions and keywords */
temp = estrdup(objrec);
- attrname = strtok(temp, "\n");
+ attrname = strtok_r(temp, "\n", &strtok_buf);
while(attrname != NULL) {
str = attrname;
iTitle = 0;
if(iGroup)
add_next_index_string(group_arr, str, 1);
}
- attrname = strtok(NULL, "\n");
+ attrname = strtok_r(NULL, "\n", &strtok_buf);
}
efree(temp);
/* All other attributes. Make a another copy first */
temp = estrdup(objrec);
- attrname = strtok(temp, "\n");
+ attrname = strtok_r(temp, "\n", &strtok_buf);
while(attrname != NULL) {
str = attrname;
/* We don't want to insert titles, descr., keywords a second time */
str++;
add_assoc_string(*return_value, attrname, str, 1);
}
- attrname = strtok(NULL, "\n");
+ attrname = strtok_r(NULL, "\n", &strtok_buf);
}
efree(temp);
zval *user_arr;
char *object, *ptr, *temp, *attrname;
int i;
+ char *strtok_buf;
object = php3_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND);
if(object == NULL)
}
temp = estrdup(ptr);
- attrname = strtok(temp, "\n");
+ attrname = strtok_r(temp, "\n", &strtok_buf);
i = 0;
while(attrname != NULL) {
char *name;
/* Add the user array */
zend_hash_index_update(return_value->value.ht, i++, &user_arr, sizeof(pval), NULL);
- attrname = strtok(NULL, "\n");
+ attrname = strtok_r(NULL, "\n", &strtok_buf);
}
efree(temp);
efree(object);
{
FILE *typelib_file;
char *typelib_name_buffer;
+ char *strtok_buf = NULL;
#if SUPPORT_INTERACTIVE
int interactive;
ELS_FETCH();
if (typelib_name_buffer[0]==';') {
continue;
}
- typelib_name = strtok(typelib_name_buffer, "\r\n"); /* get rid of newlines */
- typelib_name = strtok(typelib_name, "#");
- modifier = strtok(NULL, "#");
+ typelib_name = strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
+ typelib_name = strtok_r(typelib_name, "#", &strtok_buf);
+ modifier = strtok_r(NULL, "#", &strtok_buf);
if (modifier) {
if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
mode &= ~CONST_CS;
char *variable_buf;
DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
char *variable;
+ char *strtok_buf = NULL;
LPEXTENSION_CONTROL_BLOCK lpECB;
lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
return;
}
}
- variable = strtok(variable_buf, "\r\n");
+ variable = strtok_r(variable_buf, "\r\n", &strtok_buf);
while (variable) {
char *colon = strchr(variable, ':');
zend_hash_add(&EG(symbol_table), variable, strlen(variable)+1, &entry, sizeof(zval *), NULL);
*colon = ':';
}
- variable = strtok(NULL, "\r\n");
+ variable = strtok_r(NULL, "\r\n", &strtok_buf);
}
if (variable_buf!=static_variable_buf) {
efree(variable_buf);
{
char *p, *orig_path;
HKEY MainKey;
-
+ char *strtok_buf = NULL;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\PHP\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
return;
path++; /* step over the first / */
- path = p = strtok(path, "\\/");
+ path = p = strtok_r(path, "\\/", &strtok_buf);
while (p) {
HKEY hKey;
}
RegCloseKey(hKey);
- p = strtok(NULL, "\\/");
+ p = strtok_r(NULL, "\\/", &strtok_buf);
}
RegCloseKey(MainKey);
efree(orig_path);