Skip to contentSkip to conversation

client: fix crash from unknown properties

PATCH Applied James Prestwood 2 participants 2 messages Jun 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 client: fix crash from unknown properties

The dbus proxy code assumes that every interface has a set of properties registered in a 'proxy_interface_property' structure, assuming the interface has any properties at all. If the interface is assumed to have no properties (and no property table) but actually does, the property table lookup fails but is assumed to have succeeded and causes a crash.

This caused iwctl to crash after some properties were added to DPP since the DPP interface previously had no properties.

Now, check that the property table was valid before accessing it. This should allow properties to be added to new interfaces without crashing older versions of iwctl.

---
 client/dbus-proxy.c | 3 +++
 1 file changed, 3 insertions(+)
client/dbus-proxy.c +3 -0
index 0373a3df..624ce4aa 100644
@@ -107,6 +107,9 @@ static void proxy_interface_property_update(struct proxy_interface *proxy,
 	const struct proxy_interface_property *property_table =
 							proxy->type->properties;
 
+	if (!property_table)
+		return;
+
 	for (i = 0; property_table[i].name; i++) {
 		if (strcmp(property_table[i].name, name))
 			continue;
Signature · 1 line
2.34.1
#1 lore raw

Hi James,

Quoted 10 lines · James Prestwood

The dbus proxy code assumes that every interface has a set of properties registered in a 'proxy_interface_property' structure, assuming the interface has any properties at all. If the interface is assumed to have no properties (and no property table) but actually does, the property table lookup fails but is assumed to have succeeded and causes a crash.

This caused iwctl to crash after some properties were added to DPP since the DPP interface previously had no properties.

Quoted 7 lines

Now, check that the property table was valid before accessing it. This should allow properties to be added to new interfaces without crashing older versions of iwctl.

---
  client/dbus-proxy.c | 3 +++
  1 file changed, 3 insertions(+)

Applied, thanks.

Regards,
-Denis