Skip to content

Commit

Permalink
Don't break alignment rules accessing h_addr_list members of the
Browse files Browse the repository at this point in the history
hostent structure.
  • Loading branch information
sobomax committed Feb 3, 2021
1 parent d83a128 commit 5de77f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/registrar/save.c
Expand Up @@ -957,8 +957,10 @@ int _remove(struct sip_msg *msg, void *udomain, str *aor_uri, str *match_ct,
goto out_unlock;
}

struct sockaddr_in daddr;
memcpy(&daddr.sin_addr, he->h_addr_list[0], sizeof(daddr.sin_addr));
LM_DBG("Delete by host: '%s'\n",
inet_ntoa(*(struct in_addr *)(he->h_addr_list[0])));
inet_ntoa(daddr.sin_addr));

if (hostent_cpy(&delete_nh_he, he) != 0) {
LM_ERR("no more pkg mem\n");
Expand All @@ -984,9 +986,11 @@ int _remove(struct sip_msg *msg, void *udomain, str *aor_uri, str *match_ct,
continue;
}

struct sockaddr_in daddr;
memcpy(&daddr.sin_addr, he->h_addr_list[0], sizeof(daddr.sin_addr));
LM_DBG("next hop is [%.*s] resolving to [%s]\n",
contact->next_hop.name.len, contact->next_hop.name.s,
inet_ntoa(*(struct in_addr *)(he->h_addr_list[0])));
inet_ntoa(daddr.sin_addr));

if (match_next_hop) {
if (memcmp(delete_nh_he.h_addr_list[0],
Expand Down

0 comments on commit 5de77f5

Please sign in to comment.