]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
viced: Don't write out garbage when extending file
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 26 Feb 2013 12:17:29 +0000 (12:17 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 12:54:15 +0000 (05:54 -0700)
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 <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit e191cb889c941848fe09f04c24d969111e6dc494)

Change-Id: I517b5772241314a0854094655e25f3f75eba90d1
Reviewed-on: http://gerrit.openafs.org/9358
Tested-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/viced/afsfileprocs.c

index cf0dd0b6509f1809c24c20fc8499f9caef730db3..f00ae9bb306f2d72e086afa04548cf2eb6dc72d7 100644 (file)
@@ -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;