[sr-dev] git:master:505fb2c3: ims_qos: strip square brackets from ipv6 address for inet_pton()
Daniel-Constantin Mierla
miconda at gmail.com
Sun Jan 24 21:57:47 CET 2016
Module: kamailio
Branch: master
Commit: 505fb2c3c0f1aab1ece91514ad01debb8897efa4
URL: https://github.com/kamailio/kamailio/commit/505fb2c3c0f1aab1ece91514ad01debb8897efa4
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-24T21:56:25+01:00
ims_qos: strip square brackets from ipv6 address for inet_pton()
- reported by GH #364
---
Modified: modules/ims_qos/rx_avp.c
---
Diff: https://github.com/kamailio/kamailio/commit/505fb2c3c0f1aab1ece91514ad01debb8897efa4.diff
Patch: https://github.com/kamailio/kamailio/commit/505fb2c3c0f1aab1ece91514ad01debb8897efa4.patch
---
diff --git a/modules/ims_qos/rx_avp.c b/modules/ims_qos/rx_avp.c
index 5f8cb5a..a3feaef 100644
--- a/modules/ims_qos/rx_avp.c
+++ b/modules/ims_qos/rx_avp.c
@@ -185,8 +185,13 @@ int rx_add_framed_ip_avp(AAA_AVP_LIST * list, str ip, uint16_t version) {
}
ip_buflen = len;
}
- memcpy(ip_buf, ip.s, ip.len);
- ip_buf[ip.len] = '\0';
+ if(ip.s[0]=='[' && ip.s[ip.len-1]==']') {
+ memcpy(ip_buf, ip.s+1, ip.len-2);
+ ip_buf[ip.len-2] = '\0';
+ } else {
+ memcpy(ip_buf, ip.s, ip.len);
+ ip_buf[ip.len] = '\0';
+ }
ip_adr.addr.ai_family = version;
More information about the sr-dev
mailing list