From 30e25c74376dd8aa24018116015e57c47c1dfaf9 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 1 Mar 2013 11:22:26 +0000 Subject: [PATCH] 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 --- src/kauth/kaserver.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5