Skip to content

Commit

Permalink
apps/cms.c: Fix unreachable code in cms_main()
Browse files Browse the repository at this point in the history
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #21474)
  • Loading branch information
atishkov authored and t8m committed Jul 19, 2023
1 parent 4ec53ad commit 8c34367
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions apps/cms.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,9 @@ int cms_main(int argc, char **argv)
if ((operation & SMIME_IP) == 0 && contfile != NULL)
BIO_printf(bio_err,
"Warning: -contfile option is ignored for the given operation\n");
if (operation != SMIME_ENCRYPT && *argv != NULL)
BIO_printf(bio_err,
"Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");

if ((flags & CMS_BINARY) != 0) {
if (!(operation & SMIME_OP))
Expand Down Expand Up @@ -829,19 +832,13 @@ int cms_main(int argc, char **argv)
goto end;
}

if (*argv != NULL) {
if (operation == SMIME_ENCRYPT) {
for (; *argv != NULL; argv++) {
cert = load_cert(*argv, FORMAT_UNDEF,
"recipient certificate file");
if (cert == NULL)
goto end;
sk_X509_push(encerts, cert);
cert = NULL;
}
} else {
BIO_printf(bio_err, "Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");
}
for (; *argv != NULL; argv++) {
cert = load_cert(*argv, FORMAT_UNDEF,
"recipient certificate file");
if (cert == NULL)
goto end;
sk_X509_push(encerts, cert);
cert = NULL;
}
}

Expand Down

0 comments on commit 8c34367

Please sign in to comment.