- static structure from core can be overwritten on subsequential use
- GH #2645
... | ... |
@@ -1098,15 +1098,22 @@ static int ki_is_ip_rfc1918(sip_msg_t* _msg, str* sval) |
1098 | 1098 |
|
1099 | 1099 |
static inline ip_addr_t *strtoipX(str *ips) |
1100 | 1100 |
{ |
1101 |
+ static ip_addr_t ipb; |
|
1102 |
+ |
|
1101 | 1103 |
/* try to figure out INET class */ |
1102 | 1104 |
if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL) |
1103 | 1105 |
{ |
1104 | 1106 |
/* IPv6 */ |
1105 |
- return str2ip6(ips); |
|
1107 |
+ if(str2ip6buf(ips, &ipb) < 0) { |
|
1108 |
+ return &ipb; |
|
1109 |
+ } |
|
1106 | 1110 |
} else { |
1107 | 1111 |
/* IPv4 */ |
1108 |
- return str2ip(ips); |
|
1112 |
+ if (str2ipbuf(ips, &ipb)<0) { |
|
1113 |
+ return &ipb; |
|
1114 |
+ } |
|
1109 | 1115 |
} |
1116 |
+ return NULL; |
|
1110 | 1117 |
} |
1111 | 1118 |
|
1112 | 1119 |
static int ki_dns_sys_match_ip(sip_msg_t *msg, str *vhn, str *vip) |