[glib] GSocket: Properly initialize msg.msg_control



commit a6264a3a19c29fc7c4fe0719a8c2ff1554924b12
Author: David Zeuthen <davidz redhat com>
Date:   Mon Aug 16 12:30:25 2010 -0400

    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>

 gio/gsocket.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 880ba38..20554cb 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -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++)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]