mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-13 12:37:46 +02:00
gtlscertificate: fix certificate list parsing with trailing comments
g_tls_certificate_list_new_from_file() was supposed to ignore non-PEM content, but it accidentally required that there not be anything after the last certificate. Fix that. https://bugzilla.gnome.org/show_bug.cgi?id=727692
This commit is contained in:
@@ -476,17 +476,22 @@ g_tls_certificate_list_new_from_file (const gchar *file,
|
|||||||
{
|
{
|
||||||
gchar *cert_pem;
|
gchar *cert_pem;
|
||||||
GTlsCertificate *cert = NULL;
|
GTlsCertificate *cert = NULL;
|
||||||
|
GError *parse_error = NULL;
|
||||||
|
|
||||||
cert_pem = parse_next_pem_certificate (&p, end, FALSE, error);
|
cert_pem = parse_next_pem_certificate (&p, end, FALSE, &parse_error);
|
||||||
if (cert_pem)
|
if (cert_pem)
|
||||||
{
|
{
|
||||||
cert = g_tls_certificate_new_internal (cert_pem, NULL, error);
|
cert = g_tls_certificate_new_internal (cert_pem, NULL, &parse_error);
|
||||||
g_free (cert_pem);
|
g_free (cert_pem);
|
||||||
}
|
}
|
||||||
if (!cert)
|
if (!cert)
|
||||||
{
|
{
|
||||||
|
if (parse_error)
|
||||||
|
{
|
||||||
|
g_propagate_error (error, parse_error);
|
||||||
g_list_free_full (queue.head, g_object_unref);
|
g_list_free_full (queue.head, g_object_unref);
|
||||||
queue.head = NULL;
|
queue.head = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_queue_push_tail (&queue, cert);
|
g_queue_push_tail (&queue, cert);
|
||||||
|
Reference in New Issue
Block a user