From f56dfd22d4b40bd6a18544c226ec237e29e4fd74 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Tue, 15 Jan 2008 21:13:11 +0000 Subject: [PATCH] Make wesnoth work properly again if the datadir contains '../'. This is needed if you start wesnoth from the src directory with $ wesnoth ../ This broke the tutorial for me, since the gender macro is stored in a separate file. --- changelog | 3 ++- src/serialization/preprocessor.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog b/changelog index 17d42e9aa2c..9f5c71908bd 100644 --- a/changelog +++ b/changelog @@ -5,7 +5,8 @@ Version 1.3.14+svn: * miscellaneous and bug fixes: * Special notes should be more readable now (patch #941) * Fixed :control command to work - * Fixed boost test compile with 1.34.1 + * Fixed boost test compile with 1.34.1 + * make wesnoth work properly again if the datadir contains ../ Version 1.3.14: * campaigns: diff --git a/src/serialization/preprocessor.cpp b/src/serialization/preprocessor.cpp index 345b08c7428..e042dd8c337 100644 --- a/src/serialization/preprocessor.cpp +++ b/src/serialization/preprocessor.cpp @@ -823,8 +823,8 @@ bool preprocessor_data::get_chunk() } // Ignore filenames that start with '../' or contain '/../'. - if (nfname.rfind("../", 0) == std::string::npos - && nfname.find("/../") == std::string::npos) + if (newfilename.rfind("../", 0) == std::string::npos + && newfilename.find("/../") == std::string::npos) { if (!slowpath_) new preprocessor_file(target_, nfname); @@ -839,7 +839,7 @@ bool preprocessor_data::get_chunk() strings_.back() += res.str(); } } else { - ERR_CF << "Illegal path '" << nfname + ERR_CF << "Illegal path '" << newfilename << "' found (../ not allowed).\n"; } } else {