vlserver: initialize nvlentry elements after read 55/13755/5
authorCheyenne Wills <cwills@sinenomine.net>
Fri, 9 Aug 2019 19:25:26 +0000 (13:25 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Sep 2019 14:45:57 +0000 (10:45 -0400)
Commit 7620bd33487207b348ed7aeba45f8d743132ba84 (vlserver: fix
vlentryread() for old vldb formats) leaves the tail end of the
serverNumber, serverParition and serverFlags arrays uninitialized since
it only copies OMAXNSERVERS elements into arrays that have NMAXNSERVERS
elements.

Initialize the elements in the nvlentry server arrays that were not
copied with BADSERVERID.

Change-Id: I9533e3a40922c76d4179e0ada393103c2aa533dd
Reviewed-on: https://gerrit.openafs.org/13755
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/vlserver/vlutils.c

index 710d368..9067f08 100644 (file)
@@ -181,6 +181,12 @@ vlentryread(struct ubik_trans *trans, afs_int32 offset, char *buffer,
        memcpy(nbufp->serverNumber, oep->serverNumber, OMAXNSERVERS);
        memcpy(nbufp->serverPartition, oep->serverPartition, OMAXNSERVERS);
        memcpy(nbufp->serverFlags, oep->serverFlags, OMAXNSERVERS);
+       /* initilize the last elements to BADSERVERID */
+       for (i = OMAXNSERVERS; i < NMAXNSERVERS; i++) {
+           nbufp->serverNumber[i] = BADSERVERID;
+           nbufp->serverPartition[i] = BADSERVERID;
+           nbufp->serverFlags[i] = BADSERVERID;
+       }
     }
     return 0;
 }