Commit f4b5dc30 authored by Ernestas Kulik's avatar Ernestas Kulik 🦑 Committed by Colin Walters

gvfs: fix possible infinite loop in parse_name_internal()

If none of the closures in the hash table return a non-null value, the
loop never ends. Since the end of the hash table has been reached at
that point, g_hash_table_iter_next() starts asserting.

The possible fix is making the return value of g_hash_table_iter_next()
the condition in the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=768029
parent 375b4ca6
......@@ -178,11 +178,10 @@ parse_name_internal (GVfs *vfs,
g_rw_lock_reader_lock (&additional_schemes_lock);
g_hash_table_iter_init (&iter, priv->additional_schemes);
while (TRUE)
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &closure))
{
if (g_hash_table_iter_next (&iter, NULL, (gpointer *) &closure))
ret = closure->parse_name_func (vfs, parse_name,
closure->parse_name_data);
ret = closure->parse_name_func (vfs, parse_name,
closure->parse_name_data);
if (ret)
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment