From 8c3981293be5693f3e9895296935ba3b44ac638c Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 7 Dec 2012 04:03:01 +0000 Subject: [PATCH] elementary: safer call to mkstemp. SVN revision: 80409 --- legacy/elementary/ChangeLog | 9 +++++++-- legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_cnp.c | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 7f5986cb4f..3dfd63f3d8 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -775,11 +775,16 @@ * Fix forgotten break in elm_map that would have thrown error when the action was properly taken in fact. -2012-12-06 Daniel Juyung Seo (SeoZ) +2012-12-06 Daniel Juyung Seo (SeoZ) * Fix wheel scroll direction with shift. -2012-12-06 ChunEon Park (Hermet) +2012-12-06 ChunEon Park (Hermet) * Fix the mapbuf to show the content always. Sometimes mapbuf couldn't show the content properly. + +2012-12-07 Cedric Bail + + * Safer call to mkstemp in elm_cnp. + diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index d31312aa87..89c0ac4776 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -83,6 +83,7 @@ Fixes: * Fix wheel scroll direction with shift. * Fix the mapbuf to show it's content properly, If the content doesn't have resized, it wouldn't be showed up. + * Safer call to mkstemp in elm_cnp. Removals: diff --git a/legacy/elementary/src/lib/elm_cnp.c b/legacy/elementary/src/lib/elm_cnp.c index de1fbe6c6c..22e3a225ed 100644 --- a/legacy/elementary/src/lib/elm_cnp.c +++ b/legacy/elementary/src/lib/elm_cnp.c @@ -1872,6 +1872,7 @@ _tempfile_new(int size) #ifdef HAVE_MMAN_H Tmp_Info *info; const char *tmppath; + mode_t cur_umask; int len; info = malloc(sizeof(Tmp_Info)); @@ -1892,7 +1893,9 @@ _tempfile_new(int size) return NULL; } snprintf(info->filename,len,"%s/%sXXXXXX", tmppath, "elmcnpitem-"); + cur_umask = umask(S_IRWXO | S_IRWXG); info->fd = mkstemp(info->filename); + umask(cur_umask); # ifdef __linux__ { char *tmp;