]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
message address parser: Fixed some assert-crashes.
authorTimo Sirainen <tss@iki.fi>
Wed, 17 Sep 2008 19:34:08 +0000 (22:34 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 17 Sep 2008 19:34:08 +0000 (22:34 +0300)
--HG--
branch : HEAD

src/lib-mail/message-address.c

index ab310dfb4387e3c1a68400f73477c1dd8dff5311..d067e6496d9c7ec97c09fd8a068e319bb8382137 100644 (file)
@@ -86,7 +86,7 @@ static int parse_domain_list(struct message_address_parser_context *ctx)
                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_address_parser_context *ctx)
        /* 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)