butc: Init volheader before using it for hton
authorSimon Wilkinson <sxw@your-file-system.com>
Mon, 4 Mar 2013 16:34:20 +0000 (16:34 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 12 Mar 2013 13:51:32 +0000 (06:51 -0700)
When converting a volume header from host to network order, make
sure that any unused fields in the structure are zero'd, so we don't
end up filling them with stack garbage in the network version of
the structure.

Caught by coverity (#985956)

Change-Id: I3e039ffcb102a97afeb0e2223de12523f53b0a67
Reviewed-on: http://gerrit.openafs.org/9548
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/butc/dump.c

index c0d9695..7c836a6 100644 (file)
@@ -1859,6 +1859,8 @@ volumeHeader_hton(struct volumeHeader *hostPtr, struct volumeHeader *netPtr)
 {
     struct volumeHeader volHdr;
 
+    memset(&volHdr, 0, sizeof(volHdr));
+
     strcpy(volHdr.preamble, hostPtr->preamble);
     strcpy(volHdr.postamble, hostPtr->postamble);
     strcpy(volHdr.volumeName, hostPtr->volumeName);