Fix crash for URIs with an invalid hostname and without a path

This commit is contained in:
Enrico Tröger 2009-05-15 18:58:57 +02:00 committed by Christian Dywan
parent c217609403
commit 90e9ee4af7
2 changed files with 4 additions and 0 deletions

View file

@ -222,6 +222,8 @@ sokoke_idn_to_punycode (gchar* uri)
g_utf8_strncpy (buffer, hostname, offset); g_utf8_strncpy (buffer, hostname, offset);
hostname = buffer; hostname = buffer;
} }
else
hostname = g_strdup (hostname);
} }
else else
hostname = g_strdup (uri); hostname = g_strdup (uri);

View file

@ -62,6 +62,7 @@ magic_uri_uri (void)
test_input ("http://example.com", "http://example.com"); test_input ("http://example.com", "http://example.com");
test_input ("example.com", "http://example.com"); test_input ("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"); test_input ("/home/user/midori.html", "file:///home/user/midori.html");
a = g_get_current_dir (); a = g_get_current_dir ();
b = g_strconcat ("file://", a, G_DIR_SEPARATOR_S, "magic-uri.c", NULL); 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 ("g conference \"April 2, 7:00 am\"", NULL);
test_input ("max@mustermann.de", NULL); test_input ("max@mustermann.de", NULL);
test_input ("g max@mustermann.de", NULL); test_input ("g max@mustermann.de", NULL);
test_input ("g inurl:http://twotoasts.de bug", NULL);
} }
static void static void