From: Simon Wilkinson Date: Fri, 1 Mar 2013 11:22:26 +0000 (+0000) Subject: kauth: Don't overflow cellinfo hostAddrs array X-Git-Tag: upstream/1.8.0_pre1^2~1371 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=30e25c74376dd8aa24018116015e57c47c1dfaf9;p=packages%2Fo%2Fopenafs.git kauth: Don't overflow cellinfo hostAddrs array The hostaddrs array has MAXHOSTSPERCELL (8) available elements. The ubik connections list has MAXSERVERS (20) elements - when copying from the ubik list into the cellinfo hostaddrs list, be careful not to overflow it. Caught by coverity (#985577) Change-Id: Ie51cb939a6e3381a285787ad125342ca7a9e7cbb Reviewed-on: http://gerrit.openafs.org/9323 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index 2fca96a4d..816871ca1 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -344,6 +344,11 @@ main(int argc, char *argv[]) for (i = 1; i < MAXSERVERS; i++) { if (!serverList[i]) break; + if (i >= MAXHOSTSPERCELL) { + fprintf(stderr, + "Too many ubik servers specified on command line\n"); + exit(1); + } cellinfo.hostAddr[i].sin_addr.s_addr = serverList[i]; } cellinfo.numServers = i;