dovecot-1.2: message address parser: Fixed some assert-crashes.

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 17 22:34:12 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/79b29796d239
changeset: 8202:79b29796d239
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 17 22:34:08 2008 +0300
description:
message address parser: Fixed some assert-crashes.

diffstat:

1 file changed, 10 insertions(+), 8 deletions(-)
src/lib-mail/message-address.c |   18 ++++++++++--------

diffs (40 lines):

diff -r 979ce2cb7517 -r 79b29796d239 src/lib-mail/message-address.c
--- a/src/lib-mail/message-address.c	Tue Sep 16 13:42:01 2008 +0300
+++ b/src/lib-mail/message-address.c	Wed Sep 17 22:34:08 2008 +0300
@@ -86,7 +86,7 @@ static int parse_domain_list(struct mess
 		if ((ret = rfc822_parse_domain(&ctx->parser, ctx->str)) <= 0)
 			return ret;
 
-		while (rfc822_skip_lwsp(&ctx->parser) &&
+		while (rfc822_skip_lwsp(&ctx->parser) > 0 &&
 		       *ctx->parser.data == ',')
 			ctx->parser.data++;
 	}
@@ -237,18 +237,20 @@ static int parse_group(struct message_ad
 	/* from now on don't return -1 even if there are problems, so that
 	   the caller knows this is a group */
 	ctx->parser.data++;
-	if (rfc822_skip_lwsp(&ctx->parser) < 0)
+	if ((ret = rfc822_skip_lwsp(&ctx->parser)) <= 0)
 		ctx->addr.invalid_syntax = TRUE;
 
 	ctx->addr.mailbox = p_strdup(ctx->pool, str_c(ctx->str));
 	add_address(ctx);
 
-	if ((ret = parse_mailbox_list(ctx)) > 0) {
-		if (*ctx->parser.data != ';')
-			ret = -1;
-		else {
-			ctx->parser.data++;
-			ret = rfc822_skip_lwsp(&ctx->parser);
+	if (ret > 0) {
+		if ((ret = parse_mailbox_list(ctx)) > 0) {
+			if (*ctx->parser.data != ';')
+				ret = -1;
+			else {
+				ctx->parser.data++;
+				ret = rfc822_skip_lwsp(&ctx->parser);
+			}
 		}
 	}
 	if (ret < 0)


More information about the dovecot-cvs mailing list