From c9a9073755537aec9024635147a74a1452b520cf Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 10 Dec 2023 01:04:03 -0500 Subject: Fix segfault when section is not present --- src/ini.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ini.c b/src/ini.c index ffa258d..6917063 100644 --- a/src/ini.c +++ b/src/ini.c @@ -56,6 +56,10 @@ struct INIData *ini_getall(struct INIFILE *ini, char *section_name) { static size_t i = 0; section = ini_section_search(&ini, section_name); + if (i == section->data_count) { + i = 0; + return NULL; + } if (section->data_count) { result = section->data[i]; i++; -- cgit