Compare commits

...

1 Commits

Author SHA1 Message Date
Aswanth KC
4095d5d3d2 fix : issue 1054 - error and NULL handling
- old stores the existing parameter array from the config file.
- If there are no parameters in the config file, old is NULL.
- The code was copying from this NULL pointer, causing a crash.
- Added a NULL guard to skip the copy when old is NULL.
2026-05-26 16:48:10 +00:00

View File

@@ -180,7 +180,10 @@ int config_getlist(configmodule_interface_t *cfg, paramlist_def_t *ParamList, pa
sprintf(cfgpath, "%s.[%i]", newprefix, new_idx);
paramdef_t **old = ParamList->paramarray;
ParamList->paramarray = config_allocate_new(cfg, (new_idx + 1) * sizeof(paramdef_t *), true);
memcpy(ParamList->paramarray, old, new_idx * sizeof(paramdef_t *));
if (new_idx > 0 && old != NULL) {
memcpy(ParamList->paramarray, old, new_idx * sizeof(paramdef_t *));
}
ParamList->paramarray[new_idx] = config_allocate_new(cfg, numparams * sizeof(paramdef_t), true);
memcpy(ParamList->paramarray[new_idx], params, sizeof(paramdef_t) * numparams);