Module: kamailio
Branch: master
Commit: d1f377ff23f491bfd5162cb7bf510759440dd8e5
URL: 
https://github.com/kamailio/kamailio/commit/d1f377ff23f491bfd5162cb7bf510759440dd8e5

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2024-05-10T12:45:25+02:00

sipcapture: use local static buffers for ip address and port

- GH #3835

---

Modified: src/modules/sipcapture/hep.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/d1f377ff23f491bfd5162cb7bf510759440dd8e5.diff
Patch: 
https://github.com/kamailio/kamailio/commit/d1f377ff23f491bfd5162cb7bf510759440dd8e5.patch

---

diff --git a/src/modules/sipcapture/hep.c b/src/modules/sipcapture/hep.c
index cbe79698704..db7ea912e11 100644
--- a/src/modules/sipcapture/hep.c
+++ b/src/modules/sipcapture/hep.c
@@ -264,6 +264,8 @@ int parsing_hepv3_message(char *buf, unsigned int len)
        int totelem = 0;
        int chunk_vendor = 0, chunk_type = 0, chunk_length = 0;
        int total_length = 0;
+       static char ipbuf1[IP_ADDR_MAX_STR_SIZE];
+       static char portbuf1[INT2STR_MAX_LEN];
 
 
        hg = (struct hep_generic_recv *)pkg_malloc(sizeof(struct 
hep_generic_recv));
@@ -484,13 +486,14 @@ int parsing_hepv3_message(char *buf, unsigned int len)
        si->flags = 0;
        si->addr_info_lst = 0;
 
-       si->address_str.s = ip_addr2a(&si->address);
+       si->address_str.len =
+                       ip_addr2sbuf(&si->address, ipbuf1, sizeof(ipbuf1) - 1);
+       ipbuf1[si->address_str.len] = 0;
+       si->address_str.s = ipbuf1;
 
-       si->address_str.len = strlen(si->address_str.s);
-
-       si->port_no_str.s = int2str(si->port_no, &tmp_len);
+       si->port_no_str.s =
+                       int2strbuf(si->port_no, portbuf1, INT2STR_MAX_LEN, 
&tmp_len);
        si->port_no_str.len = tmp_len;
-       si->address_str.len = strlen(si->address_str.s);
 
        si->name.len = si->address_str.len;
        si->name.s = si->address_str.s;

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to