BUG: NULL key crashed _dbus_hash_table_lookup_string()

Fan Wu wufan9418 at gmail.com
Thu Aug 16 22:39:14 PDT 2007


If a NULL key is passed to _dbus_hash_table_lookup_string(), the
program will crash. It seems the root of the problem is in the
following code:

/* This is g_str_hash from GLib which was
 * extensively discussed/tested/profiled
 */
static unsigned int
string_hash (const char *str)
{
  const char *p = str;
  unsigned int h = *p;
 ...
}

If str is NULL, then h=*p will crash. It looks obvious to me but since
the code "was extensively discussed/tested/profiled", I hope I don't
miss something here.

Thanks,
Fan


More information about the dbus mailing list