Module: kamailio
Branch: master
Commit: cbd7810fff3d5145c1ce34c0e362b5590bb92a12
URL:
https://github.com/kamailio/kamailio/commit/cbd7810fff3d5145c1ce34c0e362b55…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2023-07-13T00:12:46+02:00
sipcapture: use memcpy instead of strncpy for coherence
---
Modified: src/modules/sipcapture/sipcapture.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cbd7810fff3d5145c1ce34c0e362b55…
Patch:
https://github.com/kamailio/kamailio/commit/cbd7810fff3d5145c1ce34c0e362b55…
---
diff --git a/src/modules/sipcapture/sipcapture.c b/src/modules/sipcapture/sipcapture.c
index 46f9059d489..de0a15174cc 100644
--- a/src/modules/sipcapture/sipcapture.c
+++ b/src/modules/sipcapture/sipcapture.c
@@ -1849,6 +1849,7 @@ static int sip_capture(
struct timeval tvb;
struct timezone tz;
char tmp_node[100];
+ str ip;
LM_DBG("CAPTURE DEBUG...\n");
@@ -2249,9 +2250,11 @@ static int sip_capture(
/* IP source and destination */
- strcpy(buf_ip, ip_addr2a(&msg->rcv.src_ip));
+ ip.s = ip_addr2a(&msg->rcv.src_ip);
+ ip.len = strlen(ip.s);
+ memcpy(buf_ip, ip.s, ip.len);
sco.source_ip.s = buf_ip;
- sco.source_ip.len = strlen(buf_ip);
+ sco.source_ip.len = ip.len;
sco.source_port = msg->rcv.src_port;
/*source ip*/
@@ -2794,7 +2797,7 @@ static int report_capture(sip_msg_t *msg, str *_table, str *_corr,
str *_data)
struct timezone tz;
char tmp_node[100];
time_t epoch_time_as_time_t;
- str corrtmp = STR_NULL, tmp;
+ str corrtmp = STR_NULL, tmp, ip;
_capture_mode_data_t *c = NULL;
@@ -2834,10 +2837,11 @@ static int report_capture(sip_msg_t *msg, str *_table, str *_corr,
str *_data)
//EMPTY_STR(sco.msg);
/* IP source and destination */
-
- strcpy(buf_ip, ip_addr2a(&msg->rcv.src_ip));
+ ip.s = ip_addr2a(&msg->rcv.src_ip);
+ ip.len = strlen(ip.s);
+ memcpy(buf_ip, ip.s, ip.len);
sco.source_ip.s = buf_ip;
- sco.source_ip.len = strlen(buf_ip);
+ sco.source_ip.len = ip.len;
sco.source_port = msg->rcv.src_port;
/*source ip*/