@cryptotaxi247 / netdata-1 / commits / b187ce96d

prevent sigsegv in config-parsers (#18476)

Costa Tsaousis committed Sep 4, 2024 at 14:53 UTC b187ce96d1b74cd904fd75c1aa7fa3ecf6207c09
1 file changed +2 -2
src/libnetdata/config/appconfig_migrate.c
+2 -2
@@ -57,8 +57,8 @@ int appconfig_move(struct config *root, const char *section_old, const char *nam
57 else {
58 // we don't have the old next item (probably a different section?)
59 // find the last MIGRATED one
60 - struct config_option *t = sect_new->values->prev;
61 - for (; t != sect_new->values ; t = t->prev) {
60 + struct config_option *t = sect_new->values ? sect_new->values->prev : NULL;
61 + for (; t && t != sect_new->values ; t = t->prev) {
62 if (t->flags & CONFIG_VALUE_MIGRATED)
63 break;
64 }