Skip to content

Commit

Permalink
pesign: Remove the first signature unless another is specified
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Ignatov <egori@altlinux.org>
  • Loading branch information
Blarse authored and vathpela committed Mar 7, 2024
1 parent 1f9e2fa commit 8f9e830
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/file_pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ pe_handle_action(pesign_context *ctxp, int action, int padding)
open_input(ctxp);
open_output(ctxp);
close_input(ctxp);
if(ctxp->signum < 0 ||
ctxp->signum >= ctxp->cms_ctx->num_signatures) {
if (ctxp->signum < 0)
ctxp->signum = 0;
if (ctxp->signum >= ctxp->cms_ctx->num_signatures) {
warnx("Invalid signature number %d.",
ctxp->signum);
errx(1, "Must be between 0 and %d.",
Expand Down

0 comments on commit 8f9e830

Please sign in to comment.