summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_file.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-03-04 12:50:38 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-03-04 12:53:42 +0100
commiteaa8e7b24939de2c49b1d02a8564a01b993dd2d3 (patch)
tree949f124b2f873e5d4cf3f66727b340405c27fcfb /crawl-ref/source/l_file.cc
parent1737cbf0d317ae771faae6f52f715c711a76dd75 (diff)
downloadcrawl-ref-eaa8e7b24939de2c49b1d02a8564a01b993dd2d3.tar.gz
crawl-ref-eaa8e7b24939de2c49b1d02a8564a01b993dd2d3.zip
Protect against symlink attacks when writing morgues and dumps.
Diffstat (limited to 'crawl-ref/source/l_file.cc')
-rw-r--r--crawl-ref/source/l_file.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/l_file.cc b/crawl-ref/source/l_file.cc
index b4b49b69e8..132987e493 100644
--- a/crawl-ref/source/l_file.cc
+++ b/crawl-ref/source/l_file.cc
@@ -193,7 +193,7 @@ LUAFN(_file_datadir_files)
LUAFN(_file_writefile)
{
const std::string fname(luaL_checkstring(ls, 1));
- FILE *f = fopen(fname.c_str(), "w");
+ FILE *f = fopen_replace(fname.c_str());
if (f)
{
fprintf(f, "%s", luaL_checkstring(ls, 2));