mirror of https://github.com/rfivet/uemacs.git
Fix CID 39919 Insecure temporary file.
This commit is contained in:
parent
4042ebe3d1
commit
e34c15741e
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef MINGW32
|
#ifdef MINGW32
|
||||||
|
@ -20,11 +21,14 @@ static void die( const char *err) {
|
||||||
/* Function copyright: git */
|
/* Function copyright: git */
|
||||||
void xmkstemp( char *template) {
|
void xmkstemp( char *template) {
|
||||||
int fd ;
|
int fd ;
|
||||||
|
mode_t o_mask ;
|
||||||
|
|
||||||
|
o_mask = umask( 0177) ;
|
||||||
fd = mkstemp( template) ;
|
fd = mkstemp( template) ;
|
||||||
if( fd < 0)
|
if( fd < 0)
|
||||||
die( "Unable to create temporary file") ;
|
die( "Unable to create temporary file") ;
|
||||||
|
|
||||||
|
umask( o_mask) ;
|
||||||
close( fd) ;
|
close( fd) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue