From 90e9ee4af7915a61ec5ed35e9ef0553d988c7d9a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enrico=20Tr=C3=B6ger?= Date: Fri, 15 May 2009 18:58:57 +0200 Subject: [PATCH] Fix crash for URIs with an invalid hostname and without a path --- midori/sokoke.c | 2 ++ tests/magic-uri.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/midori/sokoke.c b/midori/sokoke.c index 552e025c..2909821c 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -222,6 +222,8 @@ sokoke_idn_to_punycode (gchar* uri) g_utf8_strncpy (buffer, hostname, offset); hostname = buffer; } + else + hostname = g_strdup (hostname); } else hostname = g_strdup (uri); diff --git a/tests/magic-uri.c b/tests/magic-uri.c index b8fbe445..10f45e8f 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -62,6 +62,7 @@ magic_uri_uri (void) test_input ("http://example.com", "http://example.com"); test_input ("example.com", "http://example.com"); test_input ("example.com", "http://example.com"); + test_input ("www.google..com", "http://www.google..com"); test_input ("/home/user/midori.html", "file:///home/user/midori.html"); a = g_get_current_dir (); b = g_strconcat ("file://", a, G_DIR_SEPARATOR_S, "magic-uri.c", NULL); @@ -139,6 +140,7 @@ magic_uri_search (void) test_input ("g conference \"April 2, 7:00 am\"", NULL); test_input ("max@mustermann.de", NULL); test_input ("g max@mustermann.de", NULL); + test_input ("g inurl:http://twotoasts.de bug", NULL); } static void -- 2.39.5