potential error in DBus code?
Johannes Berg
johannes
Thu Dec 9 01:28:49 PST 2010
On Wed, 2010-12-08 at 18:02 -0600, Dan Williams wrote:
> On Wed, 2010-12-08 at 11:56 +0100, Johannes Berg wrote:
> > On Wed, 2010-12-08 at 11:27 +0100, Johannes Berg wrote:
> > > I'm a little confused now. We have this code:
> > >
> > > wpa_dbus_dict_begin_string_array:
> > >
> > > if (!dbus_message_iter_open_container(iter_dict_entry,
> > > DBUS_TYPE_VARIANT,
> > > DBUS_TYPE_ARRAY_AS_STRING
> > > DBUS_TYPE_STRING_AS_STRING,
> > > iter_dict_val))
> > > return FALSE;
> > >
> > > if (!dbus_message_iter_open_container(iter_dict_val, DBUS_TYPE_ARRAY,
> > > DBUS_TYPE_BYTE_AS_STRING,
> > > iter_array))
> > >
> > >
> > > and then
> > >
> > >
> > > wpa_dbus_dict_string_array_add_element:
> > > return dbus_message_iter_append_basic(iter_array, DBUS_TYPE_STRING,
> > > &elem);
> > >
> > >
> > > Shouldn't the DBUS_TYPE_BYTE_AS_STRING above be
> > > DBUS_TYPE_STRING_AS_STRING to match the array contents? I can trace this
> > > code all the way back to a commit from 2006 from Dan...
> >
> > FWIW, nothing seems to happen in dbus-send/d-feet when I change it ...
>
> Yeah, that does look like the wrong type there, probably C & P error.
> Odd that it works, though the fact that it's using the right type in the
> first iter open may save us.
Yeah, I've come to the conclusion that because we stuff it into a
variant, the inner type won't ever be put into the message (since the
variant says what type it contains), and evidently it's also not
checked...
In any case, I'll send a patch.
johannes
More information about the Hostap
mailing list