diff options
Diffstat (limited to 'ext/mime_magic/mime_magic.c')
-rw-r--r-- | ext/mime_magic/mime_magic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index b34418ef5d..d4ef4dbec0 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -1388,6 +1388,7 @@ static int ascmagic(unsigned char *buf, int nbytes) char *token; register struct names *p; int small_nbytes; + char *strtok_buf = NULL; /* these are easy, do them first */ @@ -1420,8 +1421,7 @@ static int ascmagic(unsigned char *buf, int nbytes) s = (unsigned char *) memcpy(nbuf, buf, small_nbytes); s[small_nbytes] = '\0'; has_escapes = (memchr(s, '\033', small_nbytes) != NULL); - /* XXX: not multithread safe */ - while ((token = strtok((char *) s, " \t\n\r\f")) != NULL) { + while ((token = php_strtok_r((char *) s, " \t\n\r\f", &strtok_buf)) != NULL) { s = NULL; /* make strtok() keep on tokin' */ for (p = names; p < names + NNAMES; p++) { if (STREQ(p->name, token)) { |