[dovecot-cvs] dovecot/src/lib strfuncs.c,1.37,1.38

cras at procontrol.fi cras at procontrol.fi
Thu Oct 23 12:30:07 EEST 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv19982/lib

Modified Files:
	strfuncs.c 
Log Message:
p_strndup() read str[max_chars] byte - could have possibly crashed in some
rare conditions



Index: strfuncs.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/strfuncs.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- strfuncs.c	20 Oct 2003 05:10:05 -0000	1.37
+++ strfuncs.c	23 Oct 2003 08:30:04 -0000	1.38
@@ -168,7 +168,7 @@
 		return NULL;
 
 	len = 0;
-	while (((const char *) str)[len] != '\0' && len < max_chars)
+	while (len < max_chars && ((const char *) str)[len] != '\0')
 		len++;
 
 	mem = p_malloc(pool, len+1);



More information about the dovecot-cvs mailing list