]> git.ipfire.org Git - thirdparty/strongswan.git/blobdiff - src/libcharon/attributes/mem_pool.c
mem-pool: Reject the creation of unintentionally empty pools
[thirdparty/strongswan.git] / src / libcharon / attributes / mem_pool.c
index 4cc0ce02a208a502518b4bb0ce5ceb2d2db20327..b2382c46d2c6e6942163922c6d6692165f714746 100644 (file)
@@ -702,6 +702,13 @@ mem_pool_t *mem_pool_create(char *name, host_t *base, int bits)
                {       /* only serve the second address of the subnet */
                        this->size--;
                }
+               if (!this->size)
+               {
+                       DBG1(DBG_CFG, "virtual IP pool %H/%d is empty",
+                                base, addr_bits - bits);
+                       destroy(this);
+                       return NULL;
+               }
        }
        return &this->public;
 }