summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-06-24 12:21:45 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-06-24 12:21:45 +0000
commitc0aa23fd866bd736bde69613eda17802c3543064 (patch)
tree9d7eaf94f0bb88b517c3274dcfcda08266a16f3d
parentb8f295a6d3f5febde642c913809681efa709f96f (diff)
downloadphp-git-c0aa23fd866bd736bde69613eda17802c3543064.tar.gz
MFB: Fixed bug #48465 (sys_get_temp_dir() possibly inconsistent when using
TMPDIR).
-rw-r--r--main/php_open_temporary_file.c9
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;
}
}