eina: fix potential security issue.

This also follow the behavior of eina_file_mkstemp.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Vincent Torri 2015-10-12 16:11:00 -07:00 committed by Cedric BAIL
parent 5bb1c52e3a
commit 2aa2b63907
1 changed files with 7 additions and 2 deletions

View File

@ -85,8 +85,13 @@ eina_environment_tmp_get(void)
return tmp;
#else
tmp = getenv("TMPDIR");
if (!tmp) tmp = getenv("XDG_RUNTIME_DIR");
# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
if (getuid() == geteuid())
# endif
{
tmp = getenv("TMPDIR");
if (!tmp) tmp = getenv("XDG_RUNTIME_DIR");
}
if (!tmp) tmp = "/tmp";
return tmp;