diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2009-06-24 12:21:45 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2009-06-24 12:21:45 +0000 |
commit | c0aa23fd866bd736bde69613eda17802c3543064 (patch) | |
tree | 9d7eaf94f0bb88b517c3274dcfcda08266a16f3d /main/php_open_temporary_file.c | |
parent | b8f295a6d3f5febde642c913809681efa709f96f (diff) | |
download | php-git-c0aa23fd866bd736bde69613eda17802c3543064.tar.gz |
MFB: Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using
TMPDIR).
Diffstat (limited to 'main/php_open_temporary_file.c')
-rw-r--r-- | main/php_open_temporary_file.c | 9 |
1 files changed, 8 insertions, 1 deletions
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; } } |