From 3073ca05ecef5a2c832e92a072e5b430fb40cef9 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 26 Feb 2013 12:17:29 +0000 Subject: [PATCH] viced: Don't write out garbage when extending file When we extend a file, we write a single byte of data to it - tlen is used as a source for this single byte. However, in the current code, tlen is used uninitialised. Set it to 0, so we don't write a byte of stack garbage. Caught by coverity (#986015) Reviewed-on: http://gerrit.openafs.org/9271 Reviewed-by: Derrick Brashear Reviewed-by: Chas Williams - CONTRACTOR Tested-by: BuildBot (cherry picked from commit e191cb889c941848fe09f04c24d969111e6dc494) Change-Id: I517b5772241314a0854094655e25f3f75eba90d1 Reviewed-on: http://gerrit.openafs.org/9358 Tested-by: Derrick Brashear Reviewed-by: Andrew Deason Reviewed-by: Paul Smeddle Reviewed-by: Stephan Wiesand --- src/viced/afsfileprocs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index cf0dd0b65..f00ae9bb3 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -7580,6 +7580,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, /* Set the file's length; we've already done an lseek to the right * spot above. */ + tlen = 0; /* Just a source of data for the write */ nBytes = FDH_PWRITE(fdP, &tlen, 1, Pos); if (nBytes != 1) { errorCode = -1; -- 2.39.5