[Xfce4-commits] <midori:master> Fix crasher in sokoke_hostname_from_uri and add additional tests

Christian Dywan noreply at xfce.org
Mon Dec 21 18:28:03 CET 2009


Updating branch refs/heads/master
         to d0e72f5d33e21a584c3708e31e61df29d5d68bda (commit)
       from 4e25f72768ef5dcebbefccf7281e358dc2c1543b (commit)

commit d0e72f5d33e21a584c3708e31e61df29d5d68bda
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Dec 21 18:22:57 2009 +0100

    Fix crasher in sokoke_hostname_from_uri and add additional tests

 midori/sokoke.c   |    7 +------
 tests/magic-uri.c |    2 ++
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/midori/sokoke.c b/midori/sokoke.c
index b734cde..643848c 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -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);
     }
diff --git a/tests/magic-uri.c b/tests/magic-uri.c
index 826ae89..a4e58c9 100644
--- a/tests/magic-uri.c
+++ b/tests/magic-uri.c
@@ -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;
 



More information about the Xfce4-commits mailing list