diff options
author | Sara Golemon <pollita@php.net> | 2014-08-19 13:24:49 -0700 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2014-08-19 13:24:49 -0700 |
commit | 1ec93f8069cbbcfcf825a433f4835830391801a6 (patch) | |
tree | d78737594b2ca217385fa11b3f72ec33647761dd | |
parent | 14439b79b474317f4c5c90bbca551ec3a1a5c505 (diff) | |
parent | a309dda7771503b5972b5faec2f3234ed0637781 (diff) | |
download | php-git-1ec93f8069cbbcfcf825a433f4835830391801a6.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Switch use of strtok() to gd_strtok_r()
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/gd/libgd/gdft.c | 6 |
2 files changed, 7 insertions, 2 deletions
@@ -25,4 +25,7 @@ PHP NEWS - XSL: . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike) +- GD: + . Made fontFetch's path parser thread-safe. (Sara) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 4979e1511f..4148cf47bb 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -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 |