Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  Switch use of strtok() to gd_strtok_r()
This commit is contained in:
Sara Golemon 2014-08-19 13:22:14 -07:00
commit a309dda777
2 changed files with 7 additions and 2 deletions

3
NEWS
View File

@ -5,6 +5,9 @@ PHP NEWS
- Fileinfo:
. Fixed bug #67716 (Segfault in cdf.c). (CVE-2014-3587) (Remi)
- GD
. Made fontFetch's path parser thread-safe. (Sara)
14 Aug 2014, PHP 5.6.0 Release Candidate 4
- COM:

View File

@ -390,9 +390,10 @@ static void *fontFetch (char **error, void *key)
fontlist = gdEstrdup(a->fontlist);
/*
* Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
* Must use gd_strtok_r becasuse strtok() isn't thread safe
*/
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
char *strtok_ptr_path;
/* make a fresh copy each time - strtok corrupts it. */
path = gdEstrdup (fontsearchpath);
@ -408,7 +409,8 @@ static void *fontFetch (char **error, void *key)
break;
}
}
for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
if (!strcmp(dir, ".")) {
TSRMLS_FETCH();
#if HAVE_GETCWD