glib: Make sure GLIB_OLD_LOG_API is a NUL-terminated string

Every usage in GLib ensures this but theoretically external code might
pass something else. As this is only meant to be used internally from
GLib, don't support the other case but at least avoid potential out of
bound reads.
This commit is contained in:
Sebastian Dröge 2024-10-14 18:59:04 +03:00 committed by Philip Withnall
parent 5bc28aff95
commit 44fb7c5b54

View File

@ -2625,6 +2625,7 @@ log_is_old_api (const GLogField *fields,
{
return (n_fields >= 1 &&
g_strcmp0 (fields[0].key, "GLIB_OLD_LOG_API") == 0 &&
fields[0].length < 0 &&
g_strcmp0 (fields[0].value, "1") == 0);
}