Fixes insecure use of temporary file (CVE-2014-4978).