Skip to content

Commit

Permalink
zero-out URI in case of parse ERROR
Browse files Browse the repository at this point in the history
NULL check in domain
  • Loading branch information
vladpaiu committed Jan 14, 2025
1 parent da7da69 commit 32af98a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/domain/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ int hash_table_lookup (struct sip_msg *msg, str *domain, pv_spec_t *pv)
struct domain_list *np;
pv_value_t val;

if (!domain || domain->s) {
LM_ERR("NULL domain provided\n");
return -1;
}

for (np = (*hash_table)[dom_hash(domain)]; np != NULL; np = np->next) {
if ((np->domain.len == domain->len) &&
(strncasecmp(np->domain.s, domain->s, domain->len) == 0)) {
Expand Down
2 changes: 2 additions & 0 deletions parser/parse_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
ser_error=E_BAD_URI;
uri->type=ERROR_URI_T;
update_stat(bad_URIs, 1);
/* zero out any URI fields that we had populated so far until triggering the error */
memset(uri, 0, sizeof(struct sip_uri));
return E_BAD_URI;
}

Expand Down

0 comments on commit 32af98a

Please sign in to comment.