From: Yann Ylavic Date: Mon, 12 Jul 2021 10:32:21 +0000 (+0000) Subject: mod_proxy: Fix icomplete initialization of BalancerMember(s) from the manager. X-Git-Tag: 2.5.0-alpha2-ci-test-only~898 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff0f512db16ea533789dd391d4db539946262843;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy: Fix icomplete initialization of BalancerMember(s) from the manager. Clear the workers created in ap_proxy_sync_balancer(), notably ->local_status for below ap_proxy_initialize_worker() to initialize all the child structures like ->cp and ->cp->reslist, avoiding a possible crash when the workers are used at runtime. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891477 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/changes-entries/ap_proxy_sync_balancer.txt b/changes-entries/ap_proxy_sync_balancer.txt new file mode 100644 index 00000000000..208a29f3672 --- /dev/null +++ b/changes-entries/ap_proxy_sync_balancer.txt @@ -0,0 +1,2 @@ + *) mod_proxy: Fix icomplete initialization of BalancerMember(s) from the + balancer-manager, which can lead to a crash. [Yann Ylavic] diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 3633a0ac658..f6bab191fe5 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -3681,9 +3681,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec runtime = apr_array_push(b->workers); *runtime = apr_palloc(conf->pool, sizeof(proxy_worker)); apr_global_mutex_unlock(proxy_mutex); + memset(*runtime, 0, sizeof(proxy_worker)); (*runtime)->hash = shm->hash; - (*runtime)->context = NULL; - (*runtime)->cp = NULL; (*runtime)->balancer = b; (*runtime)->s = shm; #if APR_HAS_THREADS