summaryrefslogtreecommitdiff
path: root/gcr
diff options
context:
space:
mode:
authorNiels De Graef <nielsdegraef@gmail.com>2022-08-09 23:02:01 +0200
committerNiels De Graef <nielsdegraef@gmail.com>2022-08-09 21:39:54 +0000
commitb372088b7f9c71de30503a62231ea0c9a545df8c (patch)
tree339b0b135d90918d5ed107f86fab3895687d9830 /gcr
parentb8d577f485df5b073a888907e588527a11f4af97 (diff)
downloadgcr-b372088b7f9c71de30503a62231ea0c9a545df8c.tar.gz
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.
Diffstat (limited to 'gcr')
-rw-r--r--gcr/gcr-certificate.c4
1 files changed, 4 insertions, 0 deletions
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);