From: Tobias Brunner Date: Fri, 12 Nov 2010 14:34:33 +0000 (+0100) Subject: Skip values and sections without key. X-Git-Tag: 4.5.1~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67c464d1a96b7956e27d3be53004ed26e2227781;p=thirdparty%2Fstrongswan.git Skip values and sections without key. --- diff --git a/src/libstrongswan/settings.c b/src/libstrongswan/settings.c index 558259d127..ccff84f252 100644 --- a/src/libstrongswan/settings.c +++ b/src/libstrongswan/settings.c @@ -644,6 +644,12 @@ static bool parse_section(linked_list_t *files, char *file, int level, if (parse(text, "\t ", "}", "{", &inner)) { section_t *sub; + if (!strlen(key)) + { + DBG1(DBG_LIB, "skipping section without name in '%s'", + section->name); + continue; + } if (section->sections->find_first(section->sections, (linked_list_match_t)section_find, (void**)&sub, key) != SUCCESS) @@ -673,6 +679,12 @@ static bool parse_section(linked_list_t *files, char *file, int level, if (parse(text, "\t ", "\n", NULL, &value)) { kv_t *kv; + if (!strlen(key)) + { + DBG1(DBG_LIB, "skipping value without key in '%s'", + section->name); + continue; + } if (section->kv->find_first(section->kv, (linked_list_match_t)kv_find, (void**)&kv, key) != SUCCESS)