From: Andrey Volk Date: Wed, 19 Feb 2020 10:27:36 +0000 (+0400) Subject: [apr] Fix potential dereference of a null pointer when apr_pool_create_ex() is called... X-Git-Tag: v1.10.3^2~147^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F385%2Fhead;p=thirdparty%2Ffreeswitch.git [apr] Fix potential dereference of a null pointer when apr_pool_create_ex() is called without both an allocator and a parent while global_pool is uninitialized. --- diff --git a/libs/apr/memory/unix/apr_pools.c b/libs/apr/memory/unix/apr_pools.c index c412a4aef0..7e37a5d0a0 100644 --- a/libs/apr/memory/unix/apr_pools.c +++ b/libs/apr/memory/unix/apr_pools.c @@ -821,8 +821,17 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, if (!abort_fn && parent) abort_fn = parent->abort_fn; - if (allocator == NULL) + if (allocator == NULL) { + if (!parent) { + /* There is no way to continue without an allocator when no parent */ + if (abort_fn) + abort_fn(APR_EINVAL); + + return APR_EINVAL; + } + allocator = parent->allocator; + } if ((node = allocator_alloc(allocator, MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {