]> git.ipfire.org Git - thirdparty/libvirt.git/commit
dbus: Don't unref NULL messages
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Feb 2016 10:14:11 +0000 (11:14 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Feb 2016 10:35:02 +0000 (11:35 +0100)
commit862298a2e7bef059b73f477e8a88d403c523e10b
treec00e0d8f6a09361e86419c9a328948f1f61a161d
parent21e2e08191fcc5ae7a9808c24c72e3393ad04677
dbus: Don't unref NULL messages

Apparently we are not the only ones with dumb free functions
because dbus_message_unref() does not accept NULL either. But if
I were to vote, this one is even more evil. Instead of returning
an error just like we do it immediately dereference any pointer
passed and thus crash you app. Well done DBus!

  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x7f878ebda700 (LWP 31264)]
  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
  (gdb) bt
  #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
  #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
  #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
  #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
  #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
  #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
  #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
  #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
  (gdb) frame 2
  #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
  228         dbus_message_unref(reply);
  (gdb) p reply
  $1 = (DBusMessage *) 0x0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/libvirt_private.syms
src/rpc/virnetdaemon.c
src/util/virdbus.c
src/util/virdbus.h
src/util/virfirewall.c
src/util/virsystemd.c
tests/virdbustest.c
tests/virfirewalltest.c
tests/virpolkittest.c
tests/virsystemdtest.c