[sr-dev] git:master:2e112825: ims_registrar_pcscf: fix extraction of received host in save()
Henning Westerholt
hw at skalatan.de
Wed Aug 12 20:44:17 CEST 2020
Module: kamailio
Branch: master
Commit: 2e11282502dce2b222d2884f308edf31fdd42d05
URL: https://github.com/kamailio/kamailio/commit/2e11282502dce2b222d2884f308edf31fdd42d05
Author: alexyosifov <47529095+alexyosifov at users.noreply.github.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-08-12T20:44:08+02:00
ims_registrar_pcscf: fix extraction of received host in save()
---
Modified: src/modules/ims_registrar_pcscf/save.c
---
Diff: https://github.com/kamailio/kamailio/commit/2e11282502dce2b222d2884f308edf31fdd42d05.diff
Patch: https://github.com/kamailio/kamailio/commit/2e11282502dce2b222d2884f308edf31fdd42d05.patch
---
diff --git a/src/modules/ims_registrar_pcscf/save.c b/src/modules/ims_registrar_pcscf/save.c
index a16ba48091..9432574005 100644
--- a/src/modules/ims_registrar_pcscf/save.c
+++ b/src/modules/ims_registrar_pcscf/save.c
@@ -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;
@@ -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;
More information about the sr-dev
mailing list