]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-mail: Handle parse_arg return value
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 29 Sep 2017 06:42:48 +0000 (09:42 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Wed, 4 Oct 2017 08:28:38 +0000 (11:28 +0300)
Invalid parameters did not cause error.
Broken in fa6b2cbb3

src/doveadm/doveadm-mail.c

index ccf644874d46d96913ef9b472047d432d008dbaa..a611ee7e332c06a2c2e18e9d87bac017013b324d 100644 (file)
@@ -1050,7 +1050,12 @@ doveadm_cmd_ver2_to_mail_cmd_wrapper(struct doveadm_cmd_context *cctx)
                                mctx->pool, "-%c", arg->short_opt);
 
                        optarg = (char*)arg->value.v_string;
-                       mctx->v.parse_arg(mctx, arg->short_opt);
+                       if (!mctx->v.parse_arg(mctx, arg->short_opt)) {
+                               i_error("Invalid parameter %c", arg->short_opt);
+                               doveadm_mail_cmd_free(mctx);
+                               doveadm_exit_code = EX_USAGE;
+                               return;
+                       }
 
                        array_append(&full_args, &short_opt_str, 1);
                        if (arg->type == CMD_PARAM_STR)