From 778fb6d2d15d534869461560d80524d74446bb84 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 4 Sep 2019 19:49:11 +0200 Subject: [SERVER] Fix altservers_getListForClient() The score wasn't reset when adding clients to the list, resulting in exactly one server filling up the whole list. --- src/server/ini.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/server/ini.c') diff --git a/src/server/ini.c b/src/server/ini.c index 216543b..c796d5c 100644 --- a/src/server/ini.c +++ b/src/server/ini.c @@ -110,7 +110,17 @@ int ini_parse_file(FILE* file, int (*handler)(void*, const char*, const char*, c #endif else if ( *start == '[' ) { /* A "[section]" line */ - end = find_char_or_comment( start + 1, ']' ); + int cnt = 0; + char *f = start, *sstart = start; + while ( *++f ) { + if ( *f == '[' ) cnt++; + if ( *f == ']' ) cnt--; + if ( cnt < 0 ) { + sstart = f - 1; + break; + } + } + end = find_char_or_comment( sstart + 1, ']' ); if ( *end == ']' ) { *end = '\0'; strncpy0( section, start + 1, sizeof(section) ); -- cgit v1.2.3-55-g7522