changeset 202:70646fbf2c35 HEAD

Highascii + space at end of some ENVELOPE header got into infinite loop.
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Sep 2002 16:22:27 +0300
parents 16cc35217bfb
children 24dda549b0ce
files src/lib-imap/imap-envelope.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-imap/imap-envelope.c	Mon Sep 09 15:03:44 2002 +0300
+++ b/src/lib-imap/imap-envelope.c	Mon Sep 09 16:22:27 2002 +0300
@@ -57,6 +57,9 @@
 			if (value[i] != ' ')
 				break;
 		}
+
+		if (i == len)
+			return i;
 	}
 
 	if (IS_BREAK_CHAR(value[i])) {
@@ -131,12 +134,13 @@
 	t_string_append_c(str, '"');
 	while (value_len > 0) {
 		token_len = next_token(value, value_len, &need_qp, qp);
-		i_assert(token_len > 0);
+		i_assert(token_len > 0 && token_len <= value_len);
 
 		/* header may be split to multiple lines, we don't want them */
 		while (token_len > 0 && (value[0] == '\r' ||
 					 value[0] == '\n')) {
 			value++;
+			token_len--;
 			value_len--;
 		}