From e0ea290ce94aa93ad5e7b68f296cfc3952dcec15 Mon Sep 17 00:00:00 2001 From: Anthony Squires Date: Tue, 19 May 2020 13:55:51 -0700 Subject: [PATCH] Resolve crash when signature that is removed is not at the end of the list. Also manipulate ptr level list rather than the items themselves. --- src/actions.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/actions.c b/src/actions.c index a68b6652..8631321e 100644 --- a/src/actions.c +++ b/src/actions.c @@ -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--; }