Prevent reallocs of the talloc pool itself
authorSimo Sorce <ssorce@redhat.com>
Tue, 21 Apr 2009 07:08:37 +0000 (03:08 -0400)
committerSimo Sorce <ssorce@redhat.com>
Wed, 22 Apr 2009 13:58:06 +0000 (09:58 -0400)
lib/talloc/talloc.c

index 60a48ad8112593754fe1729f2dc3e243924fc76d..33cbfd7d268dc737e95948c44575ac6c53d835d7 100644 (file)
@@ -1008,6 +1008,11 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
                return NULL;
        }
 
+       /* don't let anybody try to realloc a talloc_pool */
+       if (unlikely(tc->flags & TALLOC_FLAG_POOL)) {
+               return NULL;
+       }
+
        /* don't shrink if we have less than 1k to gain */
        if ((size < tc->size) && ((tc->size - size) < 1024)) {
                tc->size = size;