From: Simon Wilkinson Date: Tue, 26 Feb 2013 12:30:00 +0000 (+0000) Subject: ptserver: Zero ubik header before writing to it X-Git-Tag: upstream/1.6.10_pre1^2~176 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f40cc4dbdfb5ace884fcc84f0949316840cc6c6f;p=packages%2Fo%2Fopenafs.git ptserver: Zero ubik header before writing to it When using pt_util's ubik shim, if we're creating a new ubik label make sure to zero the whole structure before writing it out to disk. Otherwise we get a shorts worth of stack garbage in the resulting file. Caught by coverity (#986010) Reviewed-on: http://gerrit.openafs.org/9274 Reviewed-by: Derrick Brashear Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Jeffrey Altman Tested-by: BuildBot (cherry picked from commit 96131593b329a319b22368a9ef37788fb4e5d4f4) Change-Id: I9b2b22c075bf896a74f4b527354c8a6758ac2865 Reviewed-on: http://gerrit.openafs.org/11013 Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand --- diff --git a/src/ptserver/ptubik.c b/src/ptserver/ptubik.c index 53c8bcfc0..00bd944cf 100644 --- a/src/ptserver/ptubik.c +++ b/src/ptserver/ptubik.c @@ -40,6 +40,7 @@ ubik_BeginTrans(struct ubik_dbase *dbase, afs_int32 transMode, struct ubik_hdr thdr; if (!init) { + memset(&thdr, 0, sizeof(thdr)); thdr.version.epoch = htonl(2); thdr.version.counter = htonl(0); thdr.magic = htonl(UBIK_MAGIC);