mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-26 02:48:54 +02:00
ghostutils: Fix a crash and add some tests
https://bugzilla.gnome.org/show_bug.cgi?id=608743
This commit is contained in:
@@ -344,6 +344,9 @@ nameprep (const gchar *hostname,
|
||||
g_free (tmp);
|
||||
tmp = name;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
/* KC normalization may have created more capital letters (eg,
|
||||
* angstrom -> capital A with ring). So we have to lowercasify a
|
||||
* second time. (This is more-or-less how the nameprep algorithm
|
||||
@@ -398,8 +401,11 @@ g_hostname_to_ascii (const gchar *hostname)
|
||||
gssize llen, oldlen;
|
||||
gboolean unicode;
|
||||
|
||||
out = g_string_new (NULL);
|
||||
label = name = nameprep (hostname, -1);
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
out = g_string_new (NULL);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -591,6 +597,11 @@ g_hostname_to_unicode (const gchar *hostname)
|
||||
{
|
||||
gchar *canonicalized = nameprep (hostname, llen);
|
||||
|
||||
if (!canonicalized)
|
||||
{
|
||||
g_string_free (out, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
g_string_append (out, canonicalized);
|
||||
g_free (canonicalized);
|
||||
}
|
||||
|
Reference in New Issue
Block a user