Skip to content

Commit

Permalink
lib-mail: message_address_parse() - don't stop at <> when parsing add…
Browse files Browse the repository at this point in the history
…ress lists

And similarly don't stop at <@Domain>
  • Loading branch information
sirainen authored and GitLab committed Jun 7, 2017
1 parent 22cf8b6 commit 52818a0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/lib-mail/message-address.c
Expand Up @@ -153,18 +153,25 @@ static int parse_angle_addr(struct message_address_parser_context *ctx)
if (parse_domain_list(ctx) <= 0 || *ctx->parser.data != ':') {
if (ctx->fill_missing)
ctx->addr.route = "INVALID_ROUTE";
return -1;
if (ctx->parser.data == ctx->parser.end)
return -1;
/* try to continue anyway */
} else {
ctx->parser.data++;
}
ctx->parser.data++;
if ((ret = rfc822_skip_lwsp(&ctx->parser)) <= 0)
return ret;
}

if ((ret = parse_local_part(ctx)) <= 0)
return ret;
if (*ctx->parser.data == '@') {
if ((ret = parse_domain(ctx)) <= 0)
if (*ctx->parser.data == '>') {
/* <> address isn't valid */
} else {
if ((ret = parse_local_part(ctx)) <= 0)
return ret;
if (*ctx->parser.data == '@') {
if ((ret = parse_domain(ctx)) <= 0)
return ret;
}
}

if (*ctx->parser.data != '>')
Expand Down

0 comments on commit 52818a0

Please sign in to comment.