ce426f
commit 3cb26316b45b23dc5cfecbafdc489b28c3a52029
ce426f
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
ce426f
Date:   Thu Jan 29 10:30:09 2015 +0530
ce426f
ce426f
    Initialize nscd stats data [BZ #17892]
ce426f
    
ce426f
    The padding bytes in the statsdata struct are not initialized, due to
ce426f
    which valgrind throws a warning:
ce426f
    
ce426f
    ==11384== Memcheck, a memory error detector
ce426f
    ==11384== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
ce426f
    ==11384== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
ce426f
    ==11384== Command: nscd -d
ce426f
    ==11384==
ce426f
    Fri 25 Apr 2014 10:34:53 AM CEST - 11384: handle_request: request received (Version = 2) from PID 11396
ce426f
    Fri 25 Apr 2014 10:34:53 AM CEST - 11384:       GETSTAT
ce426f
    ==11384== Thread 6:
ce426f
    ==11384== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
ce426f
    ==11384==    at 0x4E4ACDC: send (in /lib64/libpthread-2.12.so)
ce426f
    ==11384==    by 0x11AF6B: send_stats (in /usr/sbin/nscd)
ce426f
    ==11384==    by 0x112F75: nscd_run_worker (in /usr/sbin/nscd)
ce426f
    ==11384==    by 0x4E439D0: start_thread (in /lib64/libpthread-2.12.so)
ce426f
    ==11384==    by 0x599AB6C: clone (in /lib64/libc-2.12.so)
ce426f
    ==11384==  Address 0x15708395 is on thread 6's stack
ce426f
    
ce426f
    Fix the warning by initializing the structure.
ce426f
ce426f
diff --git glibc-2.17-c758a686/nscd/nscd_stat.c glibc-2.17-c758a686/nscd/nscd_stat.c
ce426f
index 0f1f3c0..7aaa21b 100644
ce426f
--- glibc-2.17-c758a686/nscd/nscd_stat.c
ce426f
+++ glibc-2.17-c758a686/nscd/nscd_stat.c
ce426f
@@ -94,6 +94,8 @@ send_stats (int fd, struct database_dyn dbs[lastdb])
ce426f
   struct statdata data;
ce426f
   int cnt;
ce426f
 
ce426f
+  memset (&data, 0, sizeof (data));
ce426f
+
ce426f
   memcpy (data.version, compilation, sizeof (compilation));
ce426f
   data.debug_level = debug_level;
ce426f
   data.runtime = time (NULL) - start_time;