[glib] GTlsCertificate: fix loading of chain with private key
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GTlsCertificate: fix loading of chain with private key
- Date: Sat, 29 Aug 2015 14:28:04 +0000 (UTC)
commit 587068c969716df2b994362e3133c68d91455d47
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Aug 28 19:43:09 2015 -0500
GTlsCertificate: fix loading of chain with private key
If a private key (or anything, in fact) follows the final certificate in
the file, certificate parsing will be aborted and only the first
certificate in the chain will be returned, with the private key not set.
Be tolerant of this, rather than expecting the final character in the
file to be the newline following the last certificate.
https://bugzilla.gnome.org/show_bug.cgi?id=754264
gio/gtlscertificate.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/gtlscertificate.c b/gio/gtlscertificate.c
index b3d0c2c..d7dff70 100644
--- a/gio/gtlscertificate.c
+++ b/gio/gtlscertificate.c
@@ -335,13 +335,19 @@ parse_and_create_certificate_list (const gchar *data,
while (p && *p)
{
gchar *cert_pem;
+ GError *error = NULL;
- cert_pem = parse_next_pem_certificate (&p, end, FALSE, NULL);
- if (!cert_pem)
+ cert_pem = parse_next_pem_certificate (&p, end, FALSE, &error);
+ if (error)
{
g_slist_free_full (pem_list, g_free);
+ g_error_free (error);
return first_pem_list;
}
+ else if (!cert_pem)
+ {
+ break;
+ }
pem_list = g_slist_prepend (pem_list, cert_pem);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]