Skip to content

Commit

Permalink
tls_mgm: fix possible crash when reloading from DB
Browse files Browse the repository at this point in the history
The crash would occur after multiple DB reloads when there are also TLS
domains defined in the script.
  • Loading branch information
rvlad-patrascu committed Nov 18, 2021
1 parent 78e4356 commit f877f87
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions modules/tls_mgm/tls_domain.c
Expand Up @@ -775,9 +775,19 @@ int update_matching_map(struct tls_domain *tls_dom)

/* map this address to each domain filter of this tls domain */
for (domf_s = tls_dom->match_domains; domf_s; domf_s = domf_s->next) {
pos = (doms_array->size)++;
doms_array->arr[pos].hostname = domf_s;
doms_array->arr[pos].dom_link = tls_dom;
for (pos = 0; pos < doms_array->size &&
str_strcmp(&domf_s->s, &doms_array->arr[pos].hostname->s); pos++) ;

if (pos == doms_array->size) {
if (doms_array->size == DOM_FILT_ARR_MAX) {
LM_ERR("Too many domain filters per address\n");
return -1;
}

doms_array->size++;
doms_array->arr[pos].hostname = domf_s;
doms_array->arr[pos].dom_link = tls_dom;
}
}
}

Expand Down

0 comments on commit f877f87

Please sign in to comment.