From: Pierre Joye Date: Mon, 28 Mar 2011 16:43:49 +0000 (+0000) Subject: - Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent, windows fix X-Git-Tag: php-5.3.7RC1~205 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4551bd57f7b5272389f6e716f8d564f05cad2e30;p=php - Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent, windows fix --- diff --git a/NEWS b/NEWS index fffb954dad..7292458177 100644 --- a/NEWS +++ b/NEWS @@ -6,9 +6,15 @@ PHP NEWS (Dmitry) - Core: + . Fixed a crash inside dtor for error handling. (Ilia) . Fixed bug #54180 (parse_url() incorrectly parses path when ? in fragment). (tomas dot brastavicius at quantum dot lt, Pierrick) - . Fixed a crash inside dtor for error handling. (Ilia) + . Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using + TMPDIR on Windows). (Pierre) + +- cURL extension: + . Add curl.cainfo ini option to set the path to a defailt CA bundle file, used + by CURLOPT_CAINFO option. (Pierre) - DateTime extension: . Fixed bug #54340 (DateTime::add() method bug). (Adam) diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index 00a0f3f446..0ab82c7864 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -204,9 +204,13 @@ PHPAPI const char* php_get_temporary_directory(void) */ { char sTemp[MAX_PATH]; - DWORD n = GetTempPath(sizeof(sTemp),sTemp); - assert(0 < n); /* should *never* fail! */ - temporary_directory = strdup(sTemp); + DWORD len = GetTempPath(sizeof(sTemp),sTemp); + assert(0 < len); /* should *never* fail! */ + if (sTemp[len - 1] == DEFAULT_SLASH) { + temporary_directory = zend_strndup(sTemp, len - 1); + } else { + temporary_directory = zend_strndup(sTemp, len); + } return temporary_directory; } #else