cvs: php-src(PHP_5_2) /ext/mime_magic mime_magic.c /ext/standard basic_functions.c

From: Date: Sun, 26 Nov 2006 17:02:13 +0000
Subject: cvs: php-src(PHP_5_2) /ext/mime_magic mime_magic.c /ext/standard basic_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41740@lists.php.net to get a copy of this message
iliaa Sun Nov 26 17:02:13 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/mime_magic mime_magic.c /php-src/ext/standard basic_functions.c Log: Fixed bug #39623 (thread safety fixes on *nix for putenv() & mime_magic). http://cvs.php.net/viewvc.cgi/php-src/ext/mime_magic/mime_magic.c?r1=1.42.2.5.2.1&r2=1.42.2.5.2.2&diff_format=u Index: php-src/ext/mime_magic/mime_magic.c diff -u php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.1 php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.2 --- php-src/ext/mime_magic/mime_magic.c:1.42.2.5.2.1 Thu Jun 15 18:33:07 2006 +++ php-src/ext/mime_magic/mime_magic.c Sun Nov 26 17:02:13 2006 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hholzgra@php.net> | +----------------------------------------------------------------------+ - $Id: mime_magic.c,v 1.42.2.5.2.1 2006/06/15 18:33:07 dmitry Exp $ + $Id: mime_magic.c,v 1.42.2.5.2.2 2006/11/26 17:02:13 iliaa Exp $ This module contains a lot of stuff taken from Apache mod_mime_magic, so the license section is a little bit longer than usual: @@ -1388,6 +1388,7 @@ char *token; register struct names *p; int small_nbytes; + char *strtok_buf = NULL; /* these are easy, do them first */ @@ -1420,8 +1421,7 @@ 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)) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.30&r2=1.725.2.31.2.31&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.30 php-src/ext/standard/basic_functions.c:1.725.2.31.2.31 --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.30 Fri Nov 10 11:42:07 2006 +++ php-src/ext/standard/basic_functions.c Sun Nov 26 17:02:13 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.725.2.31.2.30 2006/11/10 11:42:07 dmitry Exp $ */ +/* $Id: basic_functions.c,v 1.725.2.31.2.31 2006/11/26 17:02:13 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -4398,7 +4398,8 @@ /* Check the allowed list */ if (BG(sm_allowed_env_vars) && *BG(sm_allowed_env_vars)) { char *allowed_env_vars = estrdup(BG(sm_allowed_env_vars)); - char *allowed_prefix = strtok(allowed_env_vars, ", "); + char *strtok_buf = NULL; + char *allowed_prefix = php_strtok_r(allowed_env_vars, ", ", &strtok_buf); zend_bool allowed = 0; while (allowed_prefix) { @@ -4406,7 +4407,7 @@ allowed = 1; break; } - allowed_prefix = strtok(NULL, ", "); + allowed_prefix = php_strtok_r(NULL, ", ", &strtok_buf); } efree(allowed_env_vars); if (!allowed) {

« previous php.cvs (#41740) next »