mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
MFB: Fixed bug #39623 (thread safety fixes on *nix for mime_magic extenion).
This commit is contained in:
parent
1c4d86e6d4
commit
41da75d59f
1 changed files with 2 additions and 2 deletions
|
@ -1388,6 +1388,7 @@ static int ascmagic(unsigned char *buf, int nbytes)
|
||||||
char *token;
|
char *token;
|
||||||
register struct names *p;
|
register struct names *p;
|
||||||
int small_nbytes;
|
int small_nbytes;
|
||||||
|
char *strtok_buf = NULL;
|
||||||
|
|
||||||
/* these are easy, do them first */
|
/* 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 = (unsigned char *) memcpy(nbuf, buf, small_nbytes);
|
||||||
s[small_nbytes] = '\0';
|
s[small_nbytes] = '\0';
|
||||||
has_escapes = (memchr(s, '\033', small_nbytes) != NULL);
|
has_escapes = (memchr(s, '\033', small_nbytes) != NULL);
|
||||||
/* XXX: not multithread safe */
|
while ((token = php_strtok_r((char *) s, " \t\n\r\f", &strtok_buf)) != NULL) {
|
||||||
while ((token = strtok((char *) s, " \t\n\r\f")) != NULL) {
|
|
||||||
s = NULL; /* make strtok() keep on tokin' */
|
s = NULL; /* make strtok() keep on tokin' */
|
||||||
for (p = names; p < names + NNAMES; p++) {
|
for (p = names; p < names + NNAMES; p++) {
|
||||||
if (STREQ(p->name, token)) {
|
if (STREQ(p->name, token)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue