]> spindle.queued.net Git - midori/commitdiff
Fix crasher in sokoke_hostname_from_uri and add additional tests
authorChristian Dywan <christian@twotoasts.de>
Mon, 21 Dec 2009 17:22:57 +0000 (18:22 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 21 Dec 2009 17:26:50 +0000 (18:26 +0100)
midori/sokoke.c
tests/magic-uri.c

index b734cdee6bc06b9be44c248d952b42871d7fa71e..643848cef77dd62851eca00ea3b84961b52afc86 100644 (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);
     }
index 826ae89673af113efa86983336eeb8747ccc1461..a4e58c95c0a43c12d6279d988d12129b2b412b8f 100644 (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;