Skip to content

Commit

Permalink
lib-mail: message-address: Make parser properly reject paths with spu…
Browse files Browse the repository at this point in the history
…rious trailing characters.
  • Loading branch information
stephanbosch authored and villesavolainen committed Apr 25, 2018
1 parent 2f25c13 commit 206660e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-mail/message-address.c
Expand Up @@ -396,6 +396,8 @@ static int parse_path(struct message_address_parser_context *ctx)
if (*ctx->parser.data != '<')
return -1;
if ((ret=parse_angle_addr(ctx, TRUE)) < 0 ||
(ret=rfc822_skip_lwsp(&ctx->parser)) < 0 ||
ctx->parser.data != ctx->parser.end ||
(ctx->addr.mailbox != NULL &&
(ctx->addr.domain == NULL || *ctx->addr.domain == '\0')) ||
(ctx->addr.mailbox == NULL && ctx->addr.domain != NULL)) {
Expand Down
1 change: 1 addition & 0 deletions src/lib-mail/test-message-address.c
Expand Up @@ -415,6 +415,7 @@ static void test_message_address_path_invalid(void)
"<@route@route2:user>",
"<@domain>",
"<user@>",
"<user@domain>bladiebla",
};
const struct message_address *addr;
unsigned int i;
Expand Down

0 comments on commit 206660e

Please sign in to comment.