dovecot: uni_ucs4_to_utf8(): Check len>0 first so we don't acces...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 1 21:44:58 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/d8e7699ac68e
changeset: 7084:d8e7699ac68e
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jan 01 21:44:55 2008 +0200
description:
uni_ucs4_to_utf8(): Check len>0 first so we don't access input[len].

diffstat:

1 file changed, 1 insertion(+), 1 deletion(-)
src/lib/unichar.c |    2 +-

diffs (12 lines):

diff -r de129bdc9f58 -r d8e7699ac68e src/lib/unichar.c
--- a/src/lib/unichar.c	Tue Jan 01 21:37:08 2008 +0200
+++ b/src/lib/unichar.c	Tue Jan 01 21:44:55 2008 +0200
@@ -111,7 +111,7 @@ int uni_utf8_to_ucs4(const char *input, 
 
 void uni_ucs4_to_utf8(const unichar_t *input, size_t len, buffer_t *output)
 {
-	for (; *input != '\0' && len > 0; input++, len--)
+	for (; len > 0 && *input != '\0'; input++, len--)
 		uni_ucs4_to_utf8_c(*input, output);
 }
 


More information about the dovecot-cvs mailing list