[Patch] Fix crash listing S/MIME certificates



Hi all,

I noticed a crash when I try to list S/MIME certificates, due to a missing list termination check, in 
function libbalsa_cert_subject_readable().  To be honest, I have no idea why the function did work at all – 
using strcmp0() was plain wrong…

Best,
Albrecht.
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

Attachment: pgpg2cK83tfgo.pgp
Description: PGP signature



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