[Libguestfs] [PATCH 03/14] daemon: Fix use of uninitialized stack data (found by valgrind).

Richard W.M. Jones rjones at redhat.com
Tue Jan 24 17:02:17 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

This uninitialized data was also sent over the protocol,
potentially being a serious information leak.
---
 daemon/proto.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/daemon/proto.c b/daemon/proto.c
index bf0d75f..4ca2b70 100644
--- a/daemon/proto.c
+++ b/daemon/proto.c
@@ -263,6 +263,7 @@ send_error (int errnum, const char *msg)
 
   xdrmem_create (&xdr, buf, sizeof buf, XDR_ENCODE);
 
+  memset (&hdr, 0, sizeof hdr);
   hdr.prog = GUESTFS_PROGRAM;
   hdr.vers = GUESTFS_PROTOCOL_VERSION;
   hdr.direction = GUESTFS_DIRECTION_REPLY;
@@ -315,6 +316,7 @@ reply (xdrproc_t xdrp, char *ret)
 
   xdrmem_create (&xdr, buf, sizeof buf, XDR_ENCODE);
 
+  memset (&hdr, 0, sizeof hdr);
   hdr.prog = GUESTFS_PROGRAM;
   hdr.vers = GUESTFS_PROTOCOL_VERSION;
   hdr.direction = GUESTFS_DIRECTION_REPLY;
-- 
1.7.6




More information about the Libguestfs mailing list