BUG: NULL key crashed _dbus_hash_table_lookup_string()

Fan Wu wufan9418 at gmail.com
Fri Aug 17 07:06:03 PDT 2007


> Why is a NULL key being passed to the hashing function in the first place?
>
> In general, passing NULL char* into D-Bus is not allowed.

I'm  playing around with the Gbus code Havoc modified from the Mogshot
code, and i tried to replace the glib facility functions with those in
dbus.  In the code the sender field of a message is used as the key to
check against a hash table. The problem happens when sender is null.

Hopefully all functions exposed though DBUS APIs have been careful
enough to watch out for the NULL key. But this is definitely a trap
for people trying to extend DBUS.

There are couple of ways to deal with this:
- add NULL check in the lookup_string functions
- and/or, add assert in these functions
- no code change, but document it "pass in Null key will cause crash"

Either is fine with me.

Fan


More information about the dbus mailing list