From: Simon Wilkinson Date: Tue, 26 Feb 2013 12:17:29 +0000 (+0000) Subject: viced: Don't write out garbage when extending file X-Git-Tag: upstream/1.8.0_pre1^2~1414 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e191cb889c941848fe09f04c24d969111e6dc494;p=packages%2Fo%2Fopenafs.git 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) Change-Id: I11480a5ba0a5544437e18a6b314ff98ba6256df0 Reviewed-on: http://gerrit.openafs.org/9271 Reviewed-by: Derrick Brashear Reviewed-by: Chas Williams - CONTRACTOR Tested-by: BuildBot --- diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 0998fae61..6b72bf380 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -6540,6 +6540,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;