From b372088b7f9c71de30503a62231ea0c9a545df8c Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Tue, 9 Aug 2022 23:02:01 +0200 Subject: gcr: Fix criticals if a CN is null Both the issuer CN and the subject CN can be NULL, so make sure we deal with this case. This fixes a few CRITICALs when loading a certificate that has this. --- gcr/gcr-certificate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcr') diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c index a11cf1e..2a38efb 100644 --- a/gcr/gcr-certificate.c +++ b/gcr/gcr-certificate.c @@ -1179,9 +1179,13 @@ gcr_certificate_get_interface_elements (GcrCertificate *self) g_clear_pointer (&display, g_free); display = gcr_certificate_get_subject_cn (self); + if (display == NULL) + display = g_strdup (_("Unknown")); _gcr_certificate_section_new_field_take_value (section, _("Identity"), g_steal_pointer (&display)); display = gcr_certificate_get_issuer_cn (self); + if (display == NULL) + display = g_strdup (_("Unknown")); _gcr_certificate_section_new_field_take_value (section, _("Verified by"), g_steal_pointer (&display)); datetime = gcr_certificate_get_expiry_date (self); -- cgit v1.2.1