summaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-10-06 12:10:37 +0100
committerGitHub <noreply@github.com>2020-10-06 12:10:37 +0100
commite80fc22dd996e5b0efd8c4f67700c0920e323e46 (patch)
tree427232e6c7bcdf00d241f88c064314fbb6a7c435 /src/content
parentf46509d5e2c681b6da2abdeb27779be3c36a6916 (diff)
downloadminetest-e80fc22dd996e5b0efd8c4f67700c0920e323e46.tar.gz
minetest-e80fc22dd996e5b0efd8c4f67700c0920e323e46.tar.bz2
minetest-e80fc22dd996e5b0efd8c4f67700c0920e323e46.zip
Prevent games from setting secure settings (#10460)
Diffstat (limited to 'src/content')
-rw-r--r--src/content/subgames.cpp8
-rw-r--r--src/content/subgames.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/content/subgames.cpp b/src/content/subgames.cpp
index 695ba431f..c6350f2dd 100644
--- a/src/content/subgames.cpp
+++ b/src/content/subgames.cpp
@@ -34,12 +34,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// The maximum number of identical world names allowed
#define MAX_WORLD_NAMES 100
+namespace
+{
+
bool getGameMinetestConfig(const std::string &game_path, Settings &conf)
{
std::string conf_path = game_path + DIR_DELIM + "minetest.conf";
return conf.readConfigFile(conf_path.c_str());
}
+}
+
struct GameFindPath
{
std::string path;
@@ -330,8 +335,11 @@ void loadGameConfAndInitWorld(const std::string &path, const std::string &name,
// files that were loaded before.
g_settings->clearDefaults();
set_default_settings(g_settings);
+
Settings game_defaults;
getGameMinetestConfig(gamespec.path, game_defaults);
+ game_defaults.removeSecureSettings();
+
g_settings->overrideDefaults(&game_defaults);
infostream << "Initializing world at " << final_path << std::endl;
diff --git a/src/content/subgames.h b/src/content/subgames.h
index 35b619aaf..60392639b 100644
--- a/src/content/subgames.h
+++ b/src/content/subgames.h
@@ -53,9 +53,6 @@ struct SubgameSpec
bool isValid() const { return (!id.empty() && !path.empty()); }
};
-// minetest.conf
-bool getGameMinetestConfig(const std::string &game_path, Settings &conf);
-
SubgameSpec findSubgame(const std::string &id);
SubgameSpec findWorldSubgame(const std::string &world_path);