From 716051064a29aceb38200e181676cdbde931c350 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 12 Aug 2014 20:26:24 +0200 Subject: [PATCH] fix endless loop with duplicate sections fix #191 --- option_parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/option_parser.c b/option_parser.c index 450a3ed..20d78db 100644 --- a/option_parser.c +++ b/option_parser.c @@ -42,6 +42,12 @@ static int cmdline_find_option(char *key); section_t *new_section(char *name) { + for (int i = 0; i < section_count; i++) { + if(!strcmp(name, sections[i].name)) { + die("Dublicate section in dunstrc detected.\n", -1); + } + } + section_count++; sections = realloc(sections, sizeof(section_t) * section_count); sections[section_count - 1].name = g_strdup(name);