From: Simon Wilkinson Date: Fri, 1 Mar 2013 11:31:31 +0000 (+0000) Subject: unlog: Don't overflow cells array X-Git-Tag: upstream/1.8.0_pre1^2~1370 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ff7fd58b49a41bf85df492b9f470004d4433800e;p=packages%2Fo%2Fopenafs.git unlog: Don't overflow cells array 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) Change-Id: I45fd8a55e31ad7ea86a996b593359536c7078891 Reviewed-on: http://gerrit.openafs.org/9324 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- diff --git a/src/log/unlog.c b/src/log/unlog.c index f2760aaa7..f9ee1c881 100644 --- a/src/log/unlog.c +++ b/src/log/unlog.c @@ -65,7 +65,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);