[balsa] Fix crash listing S/MIME certificates



commit 6a43d134e09b3dec9c22d181b63e4efff19f1f98
Author: Albrecht Dreß <albrecht dress arcor de>
Date:   Wed Sep 5 15:57:17 2018 -0400

    Fix crash listing S/MIME certificates
    
    * libbalsa/gmime-gpgme-signature.c
      (libbalsa_cert_subject_readable): restore a missing termination
      check.
    
    Signed-off-by: Peter Bloomfield <PeterBloomfield bellsouth net>

 ChangeLog                        | 8 ++++++++
 libbalsa/gmime-gpgme-signature.c | 6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5c61a0069..e7f88516a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-09-05  Albrecht Dreß  <albrecht dress arcor de>
+
+       Fix crash listing S/MIME certificates
+
+       * libbalsa/gmime-gpgme-signature.c
+       (libbalsa_cert_subject_readable): restore a missing termination
+       check.
+
 2018-08-29  Albrecht Dreß  <albrecht dress arcor de>
 
        Move single IMAP mailboxes to folders
diff --git a/libbalsa/gmime-gpgme-signature.c b/libbalsa/gmime-gpgme-signature.c
index cab762d3d..8e2d1ceff 100644
--- a/libbalsa/gmime-gpgme-signature.c
+++ b/libbalsa/gmime-gpgme-signature.c
@@ -268,8 +268,10 @@ libbalsa_cert_subject_readable(const gchar *subject)
         if (equals) {
             *equals++ = '\0';
             for (ldap_elem = ldap_id_list;
-                 g_strcmp0(ldap_elem->ldap_id, elements[n]) != 0;
-                 ldap_elem++);
+                 (ldap_elem->ldap_id != NULL) && (strcmp(ldap_elem->ldap_id, elements[n]) != 0);
+                 ldap_elem++) {
+               /* nothing to do */
+            }
             if (ldap_elem->ldap_id != NULL)
                 result = g_string_append(result, ldap_elem->readable);
             else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]