Skip to content

Commit

Permalink
wincert: ignore empty cert list in finalize_signatures
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 8f9e830 commit f1ee951
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/wincert.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ finalize_signatures(SECItem **sigs, int num_sigs, Pe *pe)
void *clist = NULL;
size_t clist_size = 0;

if (!pe) {
if (num_sigs == 0) {
return 0;
}

if (!pe || num_sigs < 0) {
errno = EINVAL;
return -1;
}
Expand All @@ -82,9 +86,11 @@ finalize_signatures(SECItem **sigs, int num_sigs, Pe *pe)
&clist, &clist_size) < 0)
return -1;

if (implant_cert_list(pe, clist, clist_size) < 0) {
free(clist);
return -1;
if (clist_size > 0) {
if (implant_cert_list(pe, clist, clist_size) < 0) {
free(clist);
return -1;
}
}
free(clist);
return 0;
Expand Down

0 comments on commit f1ee951

Please sign in to comment.