Skip to content

Commit

Permalink
Resolve crash when signature that is removed is not at the end of the…
Browse files Browse the repository at this point in the history
… list. Also manipulate ptr level list rather than the items themselves.
  • Loading branch information
AnthonySquires authored and vathpela committed Jun 22, 2020
1 parent 23f2074 commit e0ea290
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,12 @@ remove_signature(pesign_context *p_ctx)
cms_context *ctx = p_ctx->cms_ctx;

free(ctx->signatures[p_ctx->signum]->data);
free(ctx->signatures[p_ctx->signum]);
if (p_ctx->signum != ctx->num_signatures - 1)
memmove(ctx->signatures[p_ctx->signum],
ctx->signatures[p_ctx->signum+1],
sizeof(SECItem) *
(ctx->num_signatures - 1));
memmove(&ctx->signatures[p_ctx->signum],
&ctx->signatures[p_ctx->signum+1],
sizeof(SECItem*) *
(ctx->num_signatures - p_ctx->signum - 1));

ctx->num_signatures--;
}

0 comments on commit e0ea290

Please sign in to comment.