Set secure file permissions for temporary file
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Wed, 16 Oct 2013 02:28:53 +0000 (04:28 +0200)
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Wed, 16 Oct 2013 02:28:53 +0000 (04:28 +0200)
commit7576ff00f3e014db84ae1a044ae60a78c2222c31
tree5bbef91913f86b1ccb2240e4e2e67c43b7bc6da0
parenteea1b83cf6c47b61aea35a70d2e9ff7b2b899780
Set secure file permissions for temporary file

From glibc mkstemp man page:
       In glibc versions 2.06 and earlier, the file is created with
       permissions 0666, that is, read and write for all users.  This old
       behavior may be a security risk, especially since other UNIX flavors
       use 0600, and somebody might overlook this detail when porting
       programs.  POSIX.1-2008 adds a requirement that the file be created
       with mode 0600.

       More generally, the POSIX specification of mkstemp() does not say
       anything about file modes, so the application should make sure its
       file mode creation mask (see umask(2)) is set appropriately before
       calling mkstemp() (and mkostemp()).

And:
http://cwe.mitre.org/data/definitions/377.html
src/lib/eina/eina_file_common.c