Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8202:79b29796d239 HEAD
message address parser: Fixed some assert-crashes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 17 Sep 2008 22:34:08 +0300 |
parents | 979ce2cb7517 |
children | fb0691b3de71 |
files | src/lib-mail/message-address.c |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ /* 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)