dbus_message_append_args NULL string not allowed?

Sebastien Estienne sebastien.estienne at gmail.com
Thu Dec 30 03:18:11 PST 2004


hello, i have this simple test program and i have a sigV, i can pass a
NULL string to dbus_message_append_args?

------------------------------------------------------------------------
#include <glib.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>

#define SMBPARSER_DBUS_PATH "/net/ovibes/dbus/smbparser"
#define SMBPARSER_DBUS_INTERFACE "net.ovibes.dbus.smbparser.Signal"
#define SMBPARSER_DBUS_SRV "net.ovibes.dbus.smbparser.Service"

int
main()
{
  DBusMessage *message;

  message = dbus_message_new_method_call (SMBPARSER_DBUS_SRV,
SMBPARSER_DBUS_PATH,
                                          SMBPARSER_DBUS_INTERFACE,
"GetSharename");
  dbus_message_append_args (message, DBUS_TYPE_STRING, NULL, DBUS_TYPE_INVALID);
  return 0;
}
------------------------------------------------------------------------
compiled against the last cvs versions of dbus with:
gcc test.c  -Wall -DTEST -DDBUS_API_SUBJECT_TO_CHANGE
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I
/usr/include/dbus-1.0 -lgli\b-2.0 -ldbus-glib-1 -o test

here is a bt:
#0  0x40124c33 in strlen () from /lib/tls/libc.so.6
#1  0x40201cce in _dbus_marshal_string (str=0x804a074, byte_order=0, value=0x0)
    at dbus-marshal.c:597
#2  0x401f4bf9 in dbus_message_iter_append_string (iter=0xbffff820, value=0x0)
    at dbus-message.c:3898
#3  0x401f56a0 in dbus_message_append_args_valist (message=0x0,
    first_arg_type=115, var_args=0xbffff8bc "") at dbus-message.c:4318
#4  0x401f2b01 in dbus_message_append_args (message=0x6c, first_arg_type=0)
    at dbus-message.c:2320
#5  0x0804855e in main ()
(gdb) bt
#0  0x40124c33 in strlen () from /lib/tls/libc.so.6
#1  0x40201cce in _dbus_marshal_string (str=0x804a074, byte_order=0, value=0x0)
    at dbus-marshal.c:597
#2  0x401f4bf9 in dbus_message_iter_append_string (iter=0xbffff820, value=0x0)
    at dbus-message.c:3898
#3  0x401f56a0 in dbus_message_append_args_valist (message=0x0,
    first_arg_type=115, var_args=0xbffff8bc "") at dbus-message.c:4318
#4  0x401f2b01 in dbus_message_append_args (message=0x6c, first_arg_type=0)
    at dbus-message.c:2320
#5  0x0804855e in main ()
-------------------------------------------------------------------------
i guess a NULL string is passed to strlen, but an i missusing this function?

-- 
Sebastien Estienne


More information about the dbus mailing list