]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-client-peer - Fix segfault occurring upon backoff connect.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 14 Apr 2021 08:45:55 +0000 (10:45 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 10 May 2021 17:47:35 +0000 (17:47 +0000)
If peers decide to close and destroy immediately, the iteration in the shared
peer yields an invalid pointer for the next peer to connect. Fixed by preserving
pointer to next peer inside the loop.

src/lib-http/http-client-peer.c

index 2b1eca1fc03fc7709e6831279ce253bdfad5eab7..eff40b450772b5723e3eab86bce01a9e7666b1a3 100644 (file)
@@ -426,8 +426,10 @@ http_client_peer_shared_connect_backoff(struct http_client_peer_shared *pshared)
 
        peer = pshared->peers_list;
        while (peer != NULL) {
+               struct http_client_peer *peer_next = peer->shared_next;
+               
                http_client_peer_connect_backoff(peer);
-               peer = peer->shared_next;
+               peer = peer_next;
        }
 }