]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
unlog: Don't overflow cells array
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 1 Mar 2013 11:31:31 +0000 (11:31 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 13:00:21 +0000 (06:00 -0700)
cells has a maximum size of MAXCELLS. Doing cells[MAXCELLS] overflows
that array. Clamp our maximum number of cells at one below this to
avoid the overflow.

Caught by coverity (#98551)

Reviewed-on: http://gerrit.openafs.org/9324
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit ff7fd58b49a41bf85df492b9f470004d4433800e)

Change-Id: If6c0caed4b4fedf571c4c6c6b8466bfaaff67975
Reviewed-on: http://gerrit.openafs.org/9374
Tested-by: BuildBot <buildbot@rampaginggeek.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/log/unlog.c

index 3542e7f242828f564d6b3a81cffe3e25d13132ce..255917b5f2e439ac03e3845ae2ffdbf12ea6484d 100644 (file)
@@ -74,7 +74,7 @@ CommandProc(struct cmd_syndesc *as, void *arock)
 
     if (as->parms[0].items) {  /* A cell is provided */
        for (itp = as->parms[0].items; itp; itp = itp->next) {
-           if (i > MAXCELLS) {
+           if (i >= MAXCELLS) {
                printf
                    ("The maximum number of cells (%d) is exceeded; the rest are ignored\n",
                     MAXCELLS);