]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
kauth: Don't overflow cellinfo hostAddrs array
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 1 Mar 2013 11:22:26 +0000 (11:22 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 13:01:12 +0000 (06:01 -0700)
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)

Reviewed-on: http://gerrit.openafs.org/9323
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 30e25c74376dd8aa24018116015e57c47c1dfaf9)

Change-Id: I6bf03fada98cf6f5442a7d6a1e52e18cc91aad59
Reviewed-on: http://gerrit.openafs.org/9375
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/kauth/kaserver.c

index cc642a55e41875e4b0606a85bc580569805062e3..db70a9c1f577e36c6b87ffc72bd64602e0426448 100644 (file)
@@ -333,6 +333,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;