[sr-dev] git:master:08140c5f: hep: Store ipstr in a static buffer for exporting to cfg

Holger Hans Peter Freyther holger at moiji-mobile.com
Wed Dec 21 16:43:02 CET 2016


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

Author: Holger Hans Peter Freyther <holger at moiji-mobile.com>
Committer: Holger Hans Peter Freyther <holger at moiji-mobile.com>
Date: 2016-12-21T10:39:50+01:00

hep: Store ipstr in a static buffer for exporting to cfg

When using hep(0x003) and hep(0x004) the extracted ip address
would be written to the local ipstr buffer but when returning
to the script the buffer would already be partially overwritten.

Keep the data around long enough by storing the result in a
static buffer.

---

Modified: src/modules/sipcapture/hep.c

---

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

---

diff --git a/src/modules/sipcapture/hep.c b/src/modules/sipcapture/hep.c
index 1533c5d..11d2049 100644
--- a/src/modules/sipcapture/hep.c
+++ b/src/modules/sipcapture/hep.c
@@ -879,7 +879,7 @@ int hepv3_get_chunk(struct sip_msg *msg, char *buf, unsigned int len, int req_ch
         int chunk_vendor=0, chunk_type=0, chunk_length=0;
         int total_length = 0;
         int ret = 0;
-        char ipstr[INET6_ADDRSTRLEN];        
+        static char ipstr[INET6_ADDRSTRLEN];
 
         if(memcmp(buf, "\x48\x45\x50\x33",4) && !memcmp(buf, "\x45\x45\x50\x31",4)) {
         




More information about the sr-dev mailing list