28 lines
934 B
Diff
28 lines
934 B
Diff
From ddf689e4543171c066d728a8d1b5ebd26c7dfdff Mon Sep 17 00:00:00 2001
|
|
From: Jardel Weyrich <jweyrich@gmail.com>
|
|
Date: Tue, 18 Jul 2017 11:46:15 -0300
|
|
Subject: [PATCH 08/12] Fix memory leak caused during digital signature
|
|
validation.
|
|
|
|
---
|
|
src/pesec.c | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git src/pesec.c src/pesec.c
|
|
index 470af17..c36c5e0 100644
|
|
--- src/pesec.c
|
|
+++ src/pesec.c
|
|
@@ -274,7 +274,9 @@ static int parse_pkcs7_data(const options_t *options, const CRYPT_DATA_BLOB *blo
|
|
if (numcerts > 0) {
|
|
X509 *subject = sk_X509_value(certs, 0);
|
|
X509 *issuer = sk_X509_value(certs, numcerts - 1);
|
|
- int valid_sig = X509_verify(subject, X509_get_pubkey(issuer));
|
|
+ EVP_PKEY *issuer_pubkey = X509_get_pubkey(issuer);
|
|
+ int valid_sig = X509_verify(subject, issuer_pubkey);
|
|
+ EVP_PKEY_free(issuer_pubkey);
|
|
output("Signature", valid_sig == 1 ? "valid" : "invalid");
|
|
}
|
|
|
|
--
|
|
2.26.2.672.g232c24e857
|
|
|