Skip to content

Consider the GLogField.length of "MESSAGE"/"GLIB_DOMAIN" fields in g_log_writer_format_fields()

Sebastian Dröge requested to merge sdroege/glib:log-field-nul-termination into main

Previously it was wrongly assuming that a NUL-termianted string is passed and the whole string should be written out.

Also document this bug in the documentation of g_log_structured() to avoid surprises when using older GLib versions.


This might also be a candidate to backport to GLib 2.74 (needs docs updates then of course).

This problem was noticed with the Rust bindings where garbage was printed out because strings were not NUL-terminated (as Rust strings are not NUL-terminated but array/length tuples), see https://github.com/gtk-rs/gtk-rs-core/issues/769.

Merge request reports