]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't skip the counting if fcount_incr() is called with force==true (v2)
authorOndřej Surý <ondrej@isc.org>
Tue, 13 Aug 2024 10:48:23 +0000 (12:48 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 13 Aug 2024 10:51:22 +0000 (12:51 +0200)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.

lib/dns/resolver.c

index 78e0634aabca5be7fa4306a3bbe4385f1b018072..dd944f867094ccd1800a7299e2ccbafb7d6e6d0a 100644 (file)
@@ -1487,7 +1487,7 @@ fcount_incr(fetchctx_t *fctx, bool force) {
 
        INSIST(spill > 0);
        LOCK(&counter->lock);
-       if (!force && ++counter->count > spill) {
+       if (++counter->count > spill && !force) {
                counter->count--;
                INSIST(counter->count > 0);
                counter->dropped++;