Skip to content

Commit

Permalink
Fixed memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
olszomal committed Feb 29, 2024
1 parent 3998bca commit 58061d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,10 @@ static int msi_calc_MsiDigitalSignatureEx(FILE_FORMAT_CTX *ctx, BIO *hash)
printf("Unable to calculate MSI pre-hash ('metadata') hash\n");
return 0; /* FAILED */
}
if (ctx->msi_ctx->p_msiex) {
/* attach-signature counts MsiDigitalSignatureEx stream data twice */
OPENSSL_free(ctx->msi_ctx->p_msiex);
}
ctx->msi_ctx->p_msiex = OPENSSL_malloc(EVP_MAX_MD_SIZE);
ctx->msi_ctx->len_msiex = (uint32_t)BIO_gets(prehash,
(char *)ctx->msi_ctx->p_msiex, EVP_MAX_MD_SIZE);

Check failure

Code scanning / CodeQL

Potential use after free Critical

Memory may have been previously freed by
call to CRYPTO_free
.
Expand Down
2 changes: 1 addition & 1 deletion osslsigncode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4602,7 +4602,7 @@ int main(int argc, char **argv)
remove_file(options.outfile);
}
if (hash)
BIO_free(hash);
BIO_free_all(hash);
BIO_free(outdata);
}
if (ctx && ctx->format->ctx_cleanup) {
Expand Down

0 comments on commit 58061d7

Please sign in to comment.