aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-14 13:19:59 +0200
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-10-14 13:19:59 +0200
commit67a8feeb08e9dd6e58a1fb148a826e781ca5260d (patch)
treecef18416f6b0fe7ba6e4b14a9021272c93b75ca8 /src/bin/efreet
parentefreet: Check size of buffer and '\0' terminate (diff)
downloadefl-67a8feeb08e9dd6e58a1fb148a826e781ca5260d.tar.gz
efreet: Set umask before creating temp file
CID 1039616
Diffstat (limited to 'src/bin/efreet')
-rw-r--r--src/bin/efreet/efreet_desktop_cache_create.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/efreet/efreet_desktop_cache_create.c b/src/bin/efreet/efreet_desktop_cache_create.c
index 577091ffc9..2fc6e917d7 100644
--- a/src/bin/efreet/efreet_desktop_cache_create.c
+++ b/src/bin/efreet/efreet_desktop_cache_create.c
@@ -225,6 +225,7 @@ main(int argc, char **argv)
int i;
char file[PATH_MAX] = { '\0' };
char util_file[PATH_MAX] = { '\0' };
+ mode_t um;
if (!eina_init()) goto eina_error;
_efreet_desktop_cache_log_dom =
@@ -296,14 +297,20 @@ main(int argc, char **argv)
/* create cache */
snprintf(file, sizeof(file), "%s.XXXXXX", efreet_desktop_cache_file());
+ /* set secure umask for temporary files */
+ um = umask(0077);
tmpfd = mkstemp(file);
+ umask(um);
if (tmpfd < 0) goto error;
close(tmpfd);
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
if (!ef) goto error;
snprintf(util_file, sizeof(util_file), "%s.XXXXXX", efreet_desktop_util_cache_file());
+ /* set secure umask for temporary files */
+ um = umask(0077);
tmpfd = mkstemp(util_file);
+ umask(um);
if (tmpfd < 0) goto error;
close(tmpfd);
util_ef = eet_open(util_file, EET_FILE_MODE_READ_WRITE);