changeset 19536:c4f960341b0c

auth: If allow_nets has an invalid value, don't attempt to compare it anymore. This fixes a potential crash because net_is_in_network() was called with garbage net_ip.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 04 Jan 2016 14:15:50 -0500
parents 60e922d0b318
children 304b06f6302c
files src/auth/auth-request.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Mon Jan 04 14:10:44 2016 -0500
+++ b/src/auth/auth-request.c	Mon Jan 04 14:15:50 2016 -0500
@@ -1343,10 +1343,8 @@
 		if (net_parse_range(*net, &net_ip, &bits) < 0) {
 			auth_request_log_info(request, AUTH_SUBSYS_DB,
 				"%s: Invalid network '%s'", name, *net);
-		}
-
-		if (remote_ip->family != 0 &&
-		    net_is_in_network(remote_ip, &net_ip, bits)) {
+		} else if (remote_ip->family != 0 &&
+			   net_is_in_network(remote_ip, &net_ip, bits)) {
 			found = TRUE;
 			break;
 		}