From ba5221b46847bf6784b2d7750bb8274415780f98 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 11 Jun 2014 12:24:20 +0100 Subject: [PATCH] If the loader contains two messages with fds, don't corrupt the second There were two bugs here: we would previously overwrite the unused fds with the already-used fds instead of the other way round, and we would copy n bytes where we should have copied n ints. Where's GArray when you need it? Bug: https://bugs.freedesktop.org/show_bug.cgi?id=79694 --- dbus/dbus-message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index c6953d0..78df755 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -4204,7 +4204,7 @@ load_message (DBusMessageLoader *loader, message->n_unix_fds_allocated = message->n_unix_fds = n_unix_fds; loader->n_unix_fds -= n_unix_fds; - memmove(loader->unix_fds + n_unix_fds, loader->unix_fds, loader->n_unix_fds); + memmove (loader->unix_fds, loader->unix_fds + n_unix_fds, loader->n_unix_fds * sizeof (loader->unix_fds[0])); } else message->unix_fds = NULL; -- 2.0.0