quick-settings: validate D-Bus variant types and sanitize SSID

parent 7f91a63b
...@@ -250,9 +250,12 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -250,9 +250,12 @@ namespace XimperShellNotificationCenter.Widgets {
DBusConnection conn, string ?sender, DBusConnection conn, string ?sender,
string path, string iface, string signal, string path, string iface, string signal,
Variant params) { Variant params) {
string iface_name; if (params.n_children () == 0) return;
params.get_child (0, "s", out iface_name); Variant child = params.get_child_value (0);
if (iface_name == "org.bluez.Device1") { if (!child.is_of_type (VariantType.STRING)) {
return;
}
if (child.get_string () == "org.bluez.Device1") {
load_devices.begin (); load_devices.begin ();
} }
} }
......
...@@ -171,7 +171,7 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -171,7 +171,7 @@ namespace XimperShellNotificationCenter.Widgets {
} }
public static string ssid_to_string (uint8[] ssid) { public static string ssid_to_string (uint8[] ssid) {
return (string) ssid; return ((string) ssid).make_valid ();
} }
public static string get_signal_icon (uint8 strength) { public static string get_signal_icon (uint8 strength) {
......
...@@ -44,7 +44,8 @@ namespace XimperShellNotificationCenter.Widgets { ...@@ -44,7 +44,8 @@ namespace XimperShellNotificationCenter.Widgets {
profile_names = {}; profile_names = {};
foreach (var profile in proxy.profiles) { foreach (var profile in proxy.profiles) {
Variant ?v = profile.lookup ("Profile"); Variant ?v = profile.lookup ("Profile");
if (v != null) { if (v != null
&& v.is_of_type (VariantType.STRING)) {
profile_names += v.get_string (); profile_names += v.get_string ();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment