GSocket: Properly initialize msg.msg_control

This patch fixes this problem

   Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)
      at 0x3D5B00EA60: __sendmsg_nocancel (syscall-template.S:82)
      by 0x53F9790: g_socket_send_message (gsocket.c:2918)
      by 0x540FDD0: g_unix_connection_send_credentials (gunixconnection.c:351)
      by 0x542B93F: _g_dbus_auth_run_client (gdbusauth.c:618)
      by 0x5438001: initable_init (gdbusconnection.c:2191)
      by 0x53E09CC: g_initable_init (ginitable.c:105)
      by 0x543F6E9: g_bus_get_sync (gdbusconnection.c:6091)
      by 0x402C7E: test_connection_life_cycle (gdbus-connection.c:126)
      by 0x4C7CABB: test_case_run (gtestutils.c:1174)
      by 0x4C7CD84: g_test_run_suite_internal (gtestutils.c:1223)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
    Address 0x7fefff9fc is on thread 1's stack

Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
David Zeuthen 2010-08-16 12:30:25 -04:00
parent 4bc4590c7b
commit a6264a3a19

View File

@ -2894,6 +2894,7 @@ g_socket_send_message (GSocket *socket,
msg.msg_controllen += CMSG_SPACE (g_socket_control_message_get_size (messages[i]));
msg.msg_control = g_alloca (msg.msg_controllen);
memset (msg.msg_control, '\0', msg.msg_controllen);
cmsg = CMSG_FIRSTHDR (&msg);
for (i = 0; i < num_messages; i++)