This is an automated email from the ASF dual-hosted git repository. kezhuw pushed a commit to branch branch-3.9 in repository https://gitbox.apache.org/repos/asf/zookeeper.git
commit c18cd9ede944c58db7a2af46e36409ff34a87313 Author: fanyang <fany...@smartx.com> AuthorDate: Fri Oct 18 09:52:41 2024 +0800 ZOOKEEPER-4699: Fix hostname use-after-free in the C client Reviewers: kezhuw, ztzg Author: fanyang89 Closes #2138 from fanyang89/fix-c-client-hostname-uaf (cherry picked from commit e72f80aa38f47ac84db1bd0dadbb85f87595511e) --- zookeeper-client/zookeeper-client-c/src/zookeeper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zookeeper-client/zookeeper-client-c/src/zookeeper.c b/zookeeper-client/zookeeper-client-c/src/zookeeper.c index 5101f0bde..633bf3776 100644 --- a/zookeeper-client/zookeeper-client-c/src/zookeeper.c +++ b/zookeeper-client/zookeeper-client-c/src/zookeeper.c @@ -2558,8 +2558,9 @@ int zookeeper_interest(zhandle_t *zh, socket_t *fd, int *interest, *tv = get_timeval(zh->recv_timeout/60); zh->delay = 0; - LOG_WARN(LOGCALLBACK(zh), "Delaying connection after exhaustively trying all servers [%s]", - zh->hostname); + lock_reconfig(zh); + LOG_WARN(LOGCALLBACK(zh), "Delaying connection after exhaustively trying all servers [%s]", zh->hostname); + unlock_reconfig(zh); } else { if (addr_rw_server) { zh->addr_cur = *addr_rw_server;