From: Stephan Bosch Date: Wed, 12 Aug 2020 19:47:39 +0000 (+0200) Subject: lib-http: http-client-peer - Properly saturate result of http_client_peer_shared_max_... X-Git-Tag: 2.3.13~279 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50814cc74f6d8ee3ba4a69a6cf85f6da07c8b034;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client-peer - Properly saturate result of http_client_peer_shared_max_connections() at UINT_MAX. --- diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 356330f0cf..f8c2ecb42e 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -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; }