Skip to content

Commit

Permalink
ims_registrar_pcscf: fix extraction of received host in save()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyosifov authored and henningw committed Aug 12, 2020
1 parent e10dc0d commit 2e11282
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/modules/ims_registrar_pcscf/save.c
Expand Up @@ -128,6 +128,7 @@ static inline int update_contacts(struct sip_msg *req,struct sip_msg *rpl, udoma
char *alias_start, *p, *port_s, *proto_s;
char portbuf[5];
str alias_s;
char srcip[50];

pcscf_act_time();
local_time_now = time_now;
Expand Down Expand Up @@ -197,13 +198,7 @@ static inline int update_contacts(struct sip_msg *req,struct sip_msg *rpl, udoma
}
}
} else {
char* srcip = NULL;
if((srcip = pkg_malloc(50)) == NULL) {
LM_ERR("Error allocating memory for source IP address\n");
return -1;
}

ci.received_host.len = ip_addr2sbuf(&req->rcv.src_ip, srcip, 50);
ci.received_host.len = ip_addr2sbuf(&req->rcv.src_ip, srcip, sizeof(srcip));
ci.received_host.s = srcip;
ci.received_port = req->rcv.src_port;
ci.received_proto = req->rcv.proto;
Expand Down

0 comments on commit 2e11282

Please sign in to comment.