portableproplib/prop_object: fix an insecure temporary file (CID #62739).

This commit is contained in:
Juan RP 2015-07-26 09:11:20 +02:00
parent 36026451ce
commit 0d3c07cdee

View File

@ -849,8 +849,12 @@ _prop_object_externalize_write_file(const char *fname, const char *xml,
strcat(tname, PLISTTMP); strcat(tname, PLISTTMP);
#undef PLISTTMP #undef PLISTTMP
if ((fd = mkstemp(tname)) == -1) myumask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
if ((fd = mkstemp(tname)) == -1) {
umask(myymask);
return (false); return (false);
}
umask(myymask);
if (do_compress) { if (do_compress) {
if ((gzf = gzdopen(fd, "a")) == NULL) if ((gzf = gzdopen(fd, "a")) == NULL)