From: Ilia Alshanetsky Date: Wed, 24 Jun 2009 12:21:20 +0000 (+0000) Subject: Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using X-Git-Tag: php-5.2.11RC1~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13cd2683ccfd43d3bb365e2b3ef7653e6fd2b30d;p=php Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using TMPDIR). --- diff --git a/NEWS b/NEWS index 39d9baf58b..eed220fa75 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ - Fixed bug #48619 (imap_search ALL segfaults). (Pierre) - Fixed bug #48555 (ImageFTBBox() differs from previous versions for texts with new lines) (Takeshi Abe) +- Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using + TMPDIR). (Ilia) - Fixed bug #48450 (Compile failure under IRIX 6.5.30 building gd.c). (Kalle) - Fixed bug #48276 (date("Y") on big endian machines produces the wrong result). (Scott) diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index ee7f0df75f..af86a0b690 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -200,7 +200,14 @@ PHPAPI const char* php_get_temporary_directory(void) { char* s = getenv("TMPDIR"); if (s) { - temporary_directory = strdup(s); + int len = strlen(s); + + if (s[len - 1] == DEFAULT_SLASH) { + temporary_directory = zend_strndup(s, len - 1); + } else { + temporary_directory = zend_strndup(s, len); + } + return temporary_directory; } }