]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-client-peer - Properly saturate result of http_client_peer_shared_max_...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 12 Aug 2020 19:47:39 +0000 (21:47 +0200)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Thu, 27 Aug 2020 09:36:36 +0000 (11:36 +0200)
src/lib-http/http-client-peer.c

index 356330f0cf9f7627000ab248566b10296ea65f0e..f8c2ecb42ef28102d076ba7d1590ff35a35b0ba3 100644 (file)
@@ -549,7 +549,12 @@ http_client_peer_shared_max_connections(struct http_client_peer_shared *pshared)
 
        peer = pshared->peers_list;
        while (peer != NULL) {
-               max_conns += peer->client->set.max_parallel_connections;
+               const struct http_client_settings *set = &peer->client->set;
+               unsigned int client_max_conns = set->max_parallel_connections;
+
+               if ((UINT_MAX - max_conns) <= client_max_conns)
+                       return UINT_MAX;
+               max_conns += client_max_conns;
                peer = peer->shared_next;
        }