mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-15 00:53:49 +02:00
gdbusaddress: Require that transport names and keys are non-empty
The specification doesn’t explicitly say this, but it doesn’t say otherwise, and it would be pretty weird to have an empty transport name or key. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
8966b0f8b1
commit
131ba66160
@ -451,6 +451,15 @@ _g_dbus_address_parse_entry (const gchar *address_entry,
|
|||||||
address_entry);
|
address_entry);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
else if (s == address_entry)
|
||||||
|
{
|
||||||
|
g_set_error (error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
|
_("Transport name in address element “%s” must not be empty"),
|
||||||
|
address_entry);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
transport_name = g_strndup (address_entry, s - address_entry);
|
transport_name = g_strndup (address_entry, s - address_entry);
|
||||||
key_value_pairs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
key_value_pairs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||||
@ -474,6 +483,17 @@ _g_dbus_address_parse_entry (const gchar *address_entry,
|
|||||||
address_entry);
|
address_entry);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
else if (s == kv_pair)
|
||||||
|
{
|
||||||
|
g_set_error (error,
|
||||||
|
G_IO_ERROR,
|
||||||
|
G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
|
_("Key/Value pair %d, “%s”, in address element “%s” must not have an empty key"),
|
||||||
|
n,
|
||||||
|
kv_pair,
|
||||||
|
address_entry);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
key = g_uri_unescape_segment (kv_pair, s, NULL);
|
key = g_uri_unescape_segment (kv_pair, s, NULL);
|
||||||
value = g_uri_unescape_segment (s + 1, kv_pair + strlen (kv_pair), NULL);
|
value = g_uri_unescape_segment (s + 1, kv_pair + strlen (kv_pair), NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user