summaryrefslogtreecommitdiff
path: root/src/lib-config
diff options
context:
space:
mode:
authorDavid Leadbeater <dgl@dgl.cx>2014-12-16 12:14:23 +0000
committerDavid Leadbeater <dgl@dgl.cx>2014-12-16 12:14:23 +0000
commitdb62ddfd557799981d779914a5e82473a6b22df8 (patch)
tree4c084cb6b7680354c645258fb40917eeeedb4ea4 /src/lib-config
parent08b390b11b327f33f77a79816409b595775d4194 (diff)
downloadirssi-db62ddfd557799981d779914a5e82473a6b22df8.zip
Die if the wrong type of node is found when traversing config
Fixes issue #187. It's a bit annoying this can't do anything other than exit, however as there's no schema for the config it's only possible to validate on use. This level of config can't be accessed from Perl so a script can't cause Irssi to die (via this method at least).
Diffstat (limited to 'src/lib-config')
-rw-r--r--src/lib-config/get.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib-config/get.c b/src/lib-config/get.c
index 2f1e90e1..af02b048 100644
--- a/src/lib-config/get.c
+++ b/src/lib-config/get.c
@@ -109,6 +109,12 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
}
g_strfreev(list);
+ if (!is_node_list(node)) {
+ /* Will die. Better to not corrupt the config further in this case. */
+ g_error("Attempt to use non-list node as list. Corrupt config?");
+ return NULL;
+ }
+
/* save to cache */
str = g_strdup(section);
g_hash_table_insert(rec->cache, str, node);