dovecot-2.2: config: Don't ignore invalid network/mask in local/...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 26 18:01:29 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/02aa054c762f
changeset: 15148:02aa054c762f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 21 09:22:54 2012 +0200
description:
config: Don't ignore invalid network/mask in local/remote blocks

diffstat:

 src/config/config-parser.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 3c215bd49cd0 -r 02aa054c762f src/config/config-parser.c
--- a/src/config/config-parser.c	Tue Sep 18 21:42:34 2012 +0300
+++ b/src/config/config-parser.c	Fri Sep 21 09:22:54 2012 +0200
@@ -254,10 +254,14 @@
 	}
 
 	max_bits = IPADDR_IS_V4(&ips[0]) ? 32 : 128;
-	if (p == NULL || str_to_uint(p, &bits) < 0 || bits > max_bits)
+	if (p == NULL)
 		*bits_r = max_bits;
-	else
+	else if (str_to_uint(p, &bits) == 0 && bits <= max_bits)
 		*bits_r = bits;
+	else {
+		*error_r = t_strdup_printf("Invalid network mask: %s", p);
+		return -1;
+	}
 	return 0;
 }
 


More information about the dovecot-cvs mailing list