mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 00:50:00 -04:00
Fix off-by-one in TSIG generated key eviction
Use pre-increment (++ring->generated) instead of post-increment (ring->generated++) so the comparison against DNS_TSIG_MAXGENERATEDKEYS happens after counting the new key. With post-increment, one extra key beyond the limit was allowed before eviction kicked in.
This commit is contained in:
parent
5e10fdc295
commit
8c1fe179e3
1 changed files with 1 additions and 1 deletions
|
|
@ -1581,7 +1581,7 @@ dns_tsigkeyring_add(dns_tsigkeyring_t *ring, dns_tsigkey_t *tkey) {
|
|||
if (tkey->generated) {
|
||||
ISC_LIST_APPEND(ring->lru, tkey, link);
|
||||
dns_tsigkey_ref(tkey);
|
||||
if (ring->generated++ > DNS_TSIG_MAXGENERATEDKEYS) {
|
||||
if (++ring->generated > DNS_TSIG_MAXGENERATEDKEYS) {
|
||||
dns_tsigkey_t *key = ISC_LIST_HEAD(ring->lru);
|
||||
rm_lru(key);
|
||||
rm_hashmap(key);
|
||||
|
|
|
|||
Loading…
Reference in a new issue