[Forensics-changes] [yara] 148/407: Free stack of certs.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.3.0
in repository yara.

commit 5aa4262ef979a6313463fed3e1f81744c6d80842
Author: Wesley Shields <wxs at atarininja.org>
Date:   Mon Oct 27 16:08:30 2014 -0400

    Free stack of certs.
    
    Also, if PKCS7_get0_signers() returns NULL, break.
---
 libyara/modules/pe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libyara/modules/pe.c b/libyara/modules/pe.c
index 1d29a04..e5e5018 100644
--- a/libyara/modules/pe.c
+++ b/libyara/modules/pe.c
@@ -2417,6 +2417,8 @@ PX509_TIMESTAMPS pe_parse_certificates(
       break;
     p7 = d2i_PKCS7_bio(cert_bio, NULL);
     certs = PKCS7_get0_signers(p7, NULL, 0);
+    if (!certs)
+      break;
     for (i = 0; i < sk_X509_num(certs); i++) {
       cert = sk_X509_value(certs, i);
 
@@ -2522,6 +2524,7 @@ PX509_TIMESTAMPS pe_parse_certificates(
     BIO_set_close(cert_bio, BIO_CLOSE);
     BIO_free(cert_bio);
     cert_bio = NULL;
+    sk_X509_free(certs);
   }
 
   // Decrement counter as it gets incremented one extra time erroneously.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list