From 4b88a5abc76ed07d683d14326f2c8e624170f8f2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 12 Mar 2017 19:48:44 +0100 Subject: [PATCH] BUG 2301: validate [game] section in eressea.ini load_inifile is old stuff, should use config_get instead. --- src/kernel/config.c | 22 ++++++++++++++++++++++ src/main.c | 14 ++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index a18fc6494..4d4a0e601 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -732,6 +732,17 @@ bool config_changed(int *cache_key) { return false; } +static const char * valid_keys[] = { + "game.id", + "game.name", + "game.locale", + "game.verbose", + "game.email", + "game.mailcmd", + "game.sender", + NULL +}; + #define MAXKEYS 16 void config_set_from(const dictionary *d) { @@ -742,6 +753,8 @@ void config_set_from(const dictionary *d) int k, nkeys = iniparser_getsecnkeys(d, sec); const char *keys[MAXKEYS]; size_t slen = strlen(sec); + bool check = strcmp(sec, "game") == 0; + assert(nkeys <= MAXKEYS); assert(slen