diff src/lib/net.c @ 16043:790bb5dfadc6

net_is_in_network(): Don't assert-crash with invalid IP. It's probably better to do the check here instead of remembering for caller to do the check.
author Timo Sirainen <tss@iki.fi>
date Tue, 19 Mar 2013 12:39:43 +0200
parents 36ef72481934
children d594ce839da3
line wrap: on
line diff
--- a/src/lib/net.c	Tue Mar 19 12:18:25 2013 +0200
+++ b/src/lib/net.c	Tue Mar 19 12:39:43 2013 +0200
@@ -984,6 +984,11 @@
 		ip = &tmp_ip;
 	}
 
+	if (ip->family == 0) {
+		/* non-IPv4/IPv6 address (e.g. UNIX socket) never matches
+		   anything */
+		return FALSE;
+	}
 	if (IPADDR_IS_V4(ip) != IPADDR_IS_V4(net_ip)) {
 		/* one is IPv6 and one is IPv4 */
 		return FALSE;