]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message_address_parse() - don't stop at invalid addresses when parsing...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 7 Jun 2017 12:08:27 +0000 (15:08 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 12 Jun 2017 14:05:32 +0000 (17:05 +0300)
Also the end-group's message_address shouldn't have invalid_syntax=TRUE,
except when we didn't actually find the ending ';'

src/lib-mail/message-address.c

index d29ab31873858bcb501da6997c76761a585479b0..32c41f8e424c1b8d9cd57d1fd41ea364922e7efa 100644 (file)
@@ -286,10 +286,10 @@ static int parse_group(struct message_address_parser_context *ctx)
                        /* mailbox-list    =
                                (mailbox *("," mailbox)) / obs-mbox-list */
                        if (parse_mailbox(ctx) <= 0) {
-                               ret = -1;
-                               break;
+                               /* broken mailbox - try to continue anyway. */
                        }
-                       if (*ctx->parser.data != ',')
+                       if (ctx->parser.data == ctx->parser.end ||
+                           *ctx->parser.data != ',')
                                break;
                        ctx->parser.data++;
                        if (rfc822_skip_lwsp(&ctx->parser) <= 0) {
@@ -299,7 +299,8 @@ static int parse_group(struct message_address_parser_context *ctx)
                }
        }
        if (ret >= 0) {
-               if (*ctx->parser.data != ';')
+               if (ctx->parser.data == ctx->parser.end ||
+                   *ctx->parser.data != ';')
                        ret = -1;
                else {
                        ctx->parser.data++;