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.6.3^2~119 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=d3dca0b7dd7874dee01065e04eccd68a63fc1493;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) Reviewed-on: http://gerrit.openafs.org/9324 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear (cherry picked from commit ff7fd58b49a41bf85df492b9f470004d4433800e) Change-Id: If6c0caed4b4fedf571c4c6c6b8466bfaaff67975 Reviewed-on: http://gerrit.openafs.org/9374 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Paul Smeddle Reviewed-by: Stephan Wiesand --- diff --git a/src/log/unlog.c b/src/log/unlog.c index 3542e7f24..255917b5f 100644 --- a/src/log/unlog.c +++ b/src/log/unlog.c @@ -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);