瀏覽代碼

ims_qos: strip square brackets from ipv6 address for inet_pton()

- reported by GH #364
Daniel-Constantin Mierla 9 年之前
父節點
當前提交
505fb2c3c0
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      modules/ims_qos/rx_avp.c

+ 7 - 2
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;