From: Michael Tremer Date: Fri, 16 Apr 2021 16:15:32 +0000 (+0000) Subject: config: Properly terminate the sections array X-Git-Tag: 0.9.28~1285^2~341 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=429e5f64dd95a553d34daa9018a3aae73011100a;p=pakfire.git config: Properly terminate the sections array Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/config.c b/src/libpakfire/config.c index b64947ef5..55e3c8313 100644 --- a/src/libpakfire/config.c +++ b/src/libpakfire/config.c @@ -234,13 +234,17 @@ char** pakfire_config_sections(struct pakfire_config* config) { continue; // Make space in the array - sections = reallocarray(sections, sizeof(*sections), num_sections++ + 1); + sections = reallocarray(sections, sizeof(*sections), ++num_sections + 1); if (!sections) return NULL; sections[num_sections - 1] = strdup(entry->section); } + // Terminate the array + if (num_sections) + sections[num_sections] = NULL; + return sections; }