]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-viced-panic-if-maxhosttables-exceeded-20060228
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 28 Feb 2006 23:27:54 +0000 (23:27 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 28 Feb 2006 23:27:54 +0000 (23:27 +0000)
Do not allow HTBlocks to allocate more blocks than will fit in
hosttablesptrs.  Doing so corrupts memory.   Panic instead until
we can get this fixed right.

(cherry picked from commit 2c825a859033574b714c00d0e16ce06f126e1d6d)

src/viced/host.c

index 682297861e8bbf51ee46d5473c4c3d4b67a8d26b..43c0eb5bae490387e055dcd212740410f3bf70eb 100644 (file)
@@ -198,6 +198,11 @@ GetHTBlock()
     register int i;
     static int index = 0;
 
+    if (HTBlocks == h_MAXHOSTTABLES) {
+       ViceLog(0, ("h_MAXHOSTTABLES reached\n"));
+       ShutDownAndCore(PANIC);
+    }
+
     block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
     if (!block) {
        ViceLog(0, ("Failed malloc in GetHTBlock\n"));