Browse code

ipops: proper handling of return code for ip to buf conversion

- reported in GH #2695

Daniel-Constantin Mierla authored on 29/03/2021 07:56:36
Showing 1 changed files
... ...
@@ -1105,15 +1105,15 @@ static inline ip_addr_t *strtoipX(str *ips)
1105 1105
 	{
1106 1106
 		/* IPv6 */
1107 1107
 		if(str2ip6buf(ips, &ipb) < 0) {
1108
-			return &ipb;
1108
+			return NULL;
1109 1109
 		}
1110 1110
 	} else {
1111 1111
 		/* IPv4 */
1112 1112
 		if (str2ipbuf(ips, &ipb)<0) {
1113
-			return &ipb;
1113
+			return NULL;
1114 1114
 		}
1115 1115
 	}
1116
-	return NULL;
1116
+	return &ipb;
1117 1117
 }
1118 1118
 
1119 1119
 static int ki_dns_sys_match_ip(sip_msg_t *msg, str *vhn, str *vip)