Fix crasher in sokoke_hostname_from_uri and add additional tests

This commit is contained in:
Christian Dywan 2009-12-21 18:22:57 +01:00
parent 4e25f72768
commit d0e72f5d33
2 changed files with 3 additions and 6 deletions

View file

@ -380,12 +380,7 @@ sokoke_hostname_from_uri (const gchar* uri,
if (hostname[1] == '/')
hostname += 2;
if ((*path = g_utf8_strchr (hostname, -1, '/')))
{
gulong offset = g_utf8_pointer_to_offset (hostname, *path);
gchar* buffer = g_malloc0 (offset + 1);
g_utf8_strncpy (buffer, hostname, offset);
hostname = buffer;
}
hostname = g_strndup (hostname, *path - hostname);
else
hostname = g_strdup (hostname);
}

View file

@ -211,6 +211,8 @@ magic_uri_format (void)
"http://digilife.bz/wiki/index.php?Pythonの開発手順" },
{ "http://die-welt.net/~evgeni/LenovoBatteryLinux/", NULL },
{ "http://wiki.c3sl.ufpr.br/multiseat/index.php/Xephyr_Solution", NULL },
{ "http://şøñđëřżēıċħęŋđőmæîņĭśŧşũþėŗ.de/char.jpg", NULL },
{ "http://www.ⓖⓝⓞⓜⓔ.org/", "http://www.gnome.org/" },
};
guint i;