mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
gdbus: Validate the --dest argument
Passing an nonsense string for the --dest argument can lead to a segfault of gdbus. Thats not nice, so use our existing validation function for bus names here. https://bugzilla.gnome.org/show_bug.cgi?id=747541
This commit is contained in:
parent
3fa0a051a4
commit
21107959ab
@ -203,6 +203,12 @@ print_paths (GDBusConnection *c,
|
|||||||
GDBusNodeInfo *node;
|
GDBusNodeInfo *node;
|
||||||
guint n;
|
guint n;
|
||||||
|
|
||||||
|
if (!g_dbus_is_name (name))
|
||||||
|
{
|
||||||
|
g_printerr (_("Error: %s is not a valid name\n"), name);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
result = g_dbus_connection_call_sync (c,
|
result = g_dbus_connection_call_sync (c,
|
||||||
name,
|
name,
|
||||||
@ -863,6 +869,12 @@ handle_call (gint *argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!request_completion && !g_dbus_is_name (opt_call_dest))
|
||||||
|
{
|
||||||
|
g_printerr (_("Error: %s is not a valid bus name\n"), opt_call_dest);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* validate and complete object path */
|
/* validate and complete object path */
|
||||||
if (complete_paths)
|
if (complete_paths)
|
||||||
{
|
{
|
||||||
@ -1601,6 +1613,13 @@ handle_introspect (gint *argc,
|
|||||||
print_paths (c, opt_introspect_dest, "/");
|
print_paths (c, opt_introspect_dest, "/");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!request_completion && !g_dbus_is_name (opt_introspect_dest))
|
||||||
|
{
|
||||||
|
g_printerr (_("Error: %s is not a valid bus name\n"), opt_introspect_dest);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_introspect_object_path == NULL)
|
if (opt_introspect_object_path == NULL)
|
||||||
{
|
{
|
||||||
if (request_completion)
|
if (request_completion)
|
||||||
@ -1824,6 +1843,13 @@ handle_monitor (gint *argc,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!request_completion && !g_dbus_is_name (opt_monitor_dest))
|
||||||
|
{
|
||||||
|
g_printerr (_("Error: %s is not a valid bus name\n"), opt_monitor_dest);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (complete_paths)
|
if (complete_paths)
|
||||||
{
|
{
|
||||||
print_paths (c, opt_monitor_dest, "/");
|
print_paths (c, opt_monitor_dest, "/");
|
||||||
|
Loading…
Reference in New Issue
Block a user