Skip to content

Commit

Permalink
Module deps: Fix a corner-case leading to a crash
Browse files Browse the repository at this point in the history
When setting a dependency-inducing modparam multiple times (e.g. avpops
db_url) while having loaded no further dependency-inducing modules,
OpenSIPS would crash on startup.

Thanks to Xiao Huang for the report and fix
Fixes #1843
  • Loading branch information
liviuchircu committed Oct 4, 2019
1 parent 7d3344f commit 9c49b09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sr_module_deps.c
Expand Up @@ -149,7 +149,7 @@ int add_modparam_dependencies(struct sr_module *mod, param_export_t *param)
return 0;

/* clear previous entries in case this parameter is set multiple times */
for (it = &unsolved_deps; it->next; it = it->next) {
for (it = &unsolved_deps; it && it->next; it = it->next) {
if (strcmp(it->next->mod->exports->name, mod->exports->name) == 0 &&
(it->next->script_param &&
strcmp(it->next->script_param, param->name) == 0)) {
Expand Down

0 comments on commit 9c49b09

Please sign in to comment.