This is an automated email from the ASF dual-hosted git repository.

kezhuw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new e72f80aa3 ZOOKEEPER-4699: Fix hostname use-after-free in the C client
e72f80aa3 is described below

commit e72f80aa38f47ac84db1bd0dadbb85f87595511e
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
---
 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 97b92dd34..84a2245b2 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;

Reply via email to