viced-panic-if-maxhosttables-exceeded-20060228
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 28 Feb 2006 23:24:23 +0000 (23:24 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 28 Feb 2006 23:24:23 +0000 (23:24 +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.

src/viced/host.c

index 13cf28e..2d71968 100644 (file)
@@ -199,6 +199,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"));