From 75a97c2977bcb68ff1f3d5fb5e7f8d99e1d789b5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 21 Jan 2017 20:39:46 +0100 Subject: [PATCH] fix gcc build, introduce a hard limit on ini section size --- src/kernel/config.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 4b8bc7e72..4459ce44a 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -721,15 +721,12 @@ void config_set_from(const dictionary *d) char key[128]; const char *sec = iniparser_getsecname(d, s); int k, nkeys = iniparser_getsecnkeys(d, sec); - char *akeys[MAXKEYS]; - char ** keys = akeys; + const char *keys[MAXKEYS]; size_t slen = strlen(sec); + assert(nkeys <= MAXKEYS); assert(slenMAXKEYS) { - keys = malloc(sizeof(const char *) * nkeys); - } iniparser_getseckeys(d, sec, keys); for (k=0;k!=nkeys;++k) { const char *val; @@ -741,9 +738,6 @@ void config_set_from(const dictionary *d) config_set(key, val); } } - if (keys!=akeys) { - free(keys); - } } }