From f40cc4dbdfb5ace884fcc84f0949316840cc6c6f Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 26 Feb 2013 12:30:00 +0000 Subject: [PATCH] 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 --- src/ptserver/ptubik.c | 1 + 1 file changed, 1 insertion(+) 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); -- 2.39.5