From: Christian Brauner Date: Fri, 15 Jun 2018 10:57:36 +0000 (+0200) Subject: coverity: #1425850 X-Git-Tag: lxc-3.1.0~245^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea75396037ee97b6a993584bd3d99196d87738e4;p=thirdparty%2Flxc.git coverity: #1425850 Insecure temporary file Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_copy.c b/src/lxc/tools/lxc_copy.c index 58f3b01dd..9c2600acd 100644 --- a/src/lxc/tools/lxc_copy.c +++ b/src/lxc/tools/lxc_copy.c @@ -744,6 +744,7 @@ static char *mount_tmpfs(const char *oldname, const char *newname, { int ret, fd; size_t len; + mode_t msk; char *premount = NULL; FILE *fp = NULL; @@ -773,7 +774,9 @@ static char *mount_tmpfs(const char *oldname, const char *newname, if (ret < 0 || (size_t)ret >= len) goto err_free; + msk = umask(0022); fd = mkstemp(premount); + umask(msk); if (fd < 0) goto err_free;