This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] Initialize all of datahead structure in nscd [BZ #16791]


Hi,

The datahead structure has an unused padding field that remains
uninitialized.  Valgrind prints out a warning for it on querying a
netgroups entry.  This is harmless, but is a potential data leak since
it would result in writing out an uninitialized byte to the cache
file.  Besides, this happens only when there is a cache miss, so we're
not adding computation to any fast path.

Tested on x86_64 to verify that the valgrind warning is gone with
netgroups.

Siddhesh

	[BZ #16791]
	* nscd/nscd-client.h (datahead_init_common): Initialize unused
	field in datahead.

---
 nscd/nscd-client.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index c069bf6..663fcc5 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -243,6 +243,8 @@ datahead_init_common (struct datahead *head, nscd_ssize_t allocsize,
   head->allocsize = allocsize;
   head->recsize = recsize;
   head->usable = true;
+  /* Initialize so that we don't write out a junk byte to the cache.  */
+  head->unused = 0;
 
   head->ttl = ttl;
   /* Compute the timeout time.  */
-- 
1.8.3.1

Attachment: pgpwLBhSwOVbx.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]