[Patch] Fix crash listing S/MIME certificates

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
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.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
fix-smime-list-keys-crash.diff (text/x-patch, 779 B)
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
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAluQFwoACgkQTKlvDmfn
2fjOkggAi5m14jn9MnP5ivALPoLHy4B8ElW0GgGkt2vwWCCQIUTllnLP5cjn8qm+
XQPvARnbxDFC4C2+7jTLsxmZP6TRslQg66GHx6gbW2uOMk43GrrJQq9RqP34rP5e
Kk/c3LWEcUhcD5E1eEks3ZCESokwH6PxlQ20I2XJcgb1u9a2mxsI1DlRpB1W5R/8
8Q13gJPg9g9H9krHPfZPViTNKhorUoqEH3pd4pOtusldHOEQNSvqzVy5yLkGG+cs
72cLnw2L0bRc1w+SyjMOoCWxLwmC/p65pmG5nSElGCqYGX0f2pS9s4JelyX4ATjW
Kj91whF8Q4059P1ky4myo4vBJAEEPw==
=Q/9W
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.