From: Joshua Rogers Date: Tue, 21 Oct 2025 05:31:41 +0000 (+0000) Subject: Fix Auth::User::absorb() IP list transfer logic (#2194) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70a89a207f13885a7fdd8bad3af1957fe98b3d4d;p=thirdparty%2Fsquid.git Fix Auth::User::absorb() IP list transfer logic (#2194) Detach IP from source list before reattaching to destination and decrement ipcount. This prevents list corruption and counter mismatch. --- diff --git a/src/auth/User.cc b/src/auth/User.cc index 7b274386aa..f1f29738b2 100644 --- a/src/auth/User.cc +++ b/src/auth/User.cc @@ -106,12 +106,13 @@ Auth::User::absorb(Auth::User::Pointer from) } if (!found) { - /* This ip is not in the seen list. Add it. */ - dlinkAddTail(&new_ipdata->node, &ipdata->node, &ip_list); - ++ipcount; /* remove from the source list */ dlinkDelete(&new_ipdata->node, &(from->ip_list)); - ++from->ipcount; + assert(from->ipcount); + --from->ipcount; + /* This ip is not in the seen list. Add it. */ + dlinkAddTail(new_ipdata, &new_ipdata->node, &ip_list); + ++ipcount; } } }