certificate: g_tls_certificate_new_from_pem invalid read on non null terminated data
g_tls_certificate_new_from_pem accepts data and len. If you pass data that is not null terminated an invalid read will happen. The invalid read seems to happen here: https://gitlab.gnome.org/GNOME/glib/-/blob/master/gio/gtlscertificate.c#L426 As far as I can see it the code is assuming that the string must be null terminated and does not take into account the data len.
Part of the valgrind report shows the following:
==23702== Invalid read of size 1
==23702== at 0x6873FF4: parse_next_pem_certificate (gtlscertificate.c:359)
==23702== by 0x6874803: parse_and_create_certificate_list (gtlscertificate.c:380)
==23702== by 0x6874803: parse_and_create_certificate (gtlscertificate.c:475)
==23702== by 0x6874A2D: g_tls_certificate_new_from_pem (gtlscertificate.c:547)
Edited by Ignacio Casal Quinteiro