libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 8a1ae1caf34c3d468dc96cd1c8681d93e265ff10
parent 7eb3139e9a65cc666a976b7eb811dd9fcb7f5099
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Tue,  6 Oct 2020 19:23:39 +0300

memorypool: more sanity checks

Diffstat:
Msrc/microhttpd/memorypool.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c @@ -98,6 +98,7 @@ MHD_init_mem_pools_ (void) #else MHD_sys_page_size_ = MHD_DEF_PAGE_SIZE_; #endif /* _WIN32 */ + mhd_assert (0 == (MHD_sys_page_size_ % ALIGN_SIZE)); } @@ -147,6 +148,7 @@ MHD_pool_create (size_t max) struct MemoryPool *pool; size_t alloc_size; + mhd_assert (max > 0); pool = malloc (sizeof (struct MemoryPool)); if (NULL == pool) return NULL; @@ -195,6 +197,7 @@ MHD_pool_create (size_t max) pool->is_mmap = true; } #endif /* _WIN32 || MAP_ANONYMOUS */ + mhd_assert (0 == (((uintptr_t) pool->memory) % ALIGN_SIZE)); pool->pos = 0; pool->end = alloc_size; pool->size = alloc_size;