diff src/lib/net.c @ 21322:5ab8dc1a4a6f

global: Change string position/length from unsigned int to size_t Mainly to avoid truncating >4GB strings, which might potentially cause some security holes. Normally there are other limits, which prevent such excessive strings from being created in the first place. I'm sure this didn't find everything. Maybe everything could be found with compiler warnings. -Wconversion kind of does it, but it gives way too many unnecessary warnings. These were mainly found with: grep " = strlen" egrep "unsigned int.*(size|len)"
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 12 Dec 2016 07:19:55 +0200
parents 3f83d38ba0b3
children 59437f8764c6
line wrap: on
line diff
--- a/src/lib/net.c	Mon Dec 12 05:16:28 2016 +0200
+++ b/src/lib/net.c	Mon Dec 12 07:19:55 2016 +0200
@@ -963,7 +963,7 @@
 		T_BEGIN {
 			if (addr[0] == '[') {
 				/* allow [ipv6 addr] */
-				unsigned int len = strlen(addr);
+				size_t len = strlen(addr);
 				if (addr[len-1] == ']')
 					addr = t_strndup(addr+1, len-2);
 			}