Merge branch '1875-xdgmimecache-robustness' into 'master'

xdgmime: Prevent infinite loops from badly-formed MIME registrations

Closes #1875

See merge request GNOME/glib!1085
This commit is contained in:
Sebastian Dröge 2019-09-13 11:42:55 +00:00
commit 6d4738ed22

View File

@ -965,7 +965,9 @@ _xdg_mime_cache_mime_type_subclass (const char *mime,
for (j = 0; j < n_parents; j++)
{
parent_offset = GET_UINT32 (cache->buffer, offset + 4 + 4 * j);
if (_xdg_mime_cache_mime_type_subclass (cache->buffer + parent_offset, ubase))
if (strcmp (cache->buffer + parent_offset, mime) != 0 &&
strcmp (cache->buffer + parent_offset, umime) != 0 &&
_xdg_mime_cache_mime_type_subclass (cache->buffer + parent_offset, ubase))
return 1;
}