mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
resolved: refuse modifying DnsAnswer objects that have more than one reference
DnsAnswer objects should be considered immutable after having passed to more than one user, i.e. with a reference counter > 1. Enforce that in code, so that we can track down misuses easier.
This commit is contained in:
parent
d12bf2bdff
commit
c296dd2eea
@ -81,6 +81,8 @@ int dns_answer_add(DnsAnswer *a, DnsResourceRecord *rr, int ifindex) {
|
||||
|
||||
if (!a)
|
||||
return -ENOSPC;
|
||||
if (a->n_ref > 1)
|
||||
return -EBUSY;
|
||||
|
||||
for (i = 0; i < a->n_rrs; i++) {
|
||||
if (a->items[i].ifindex != ifindex)
|
||||
|
Loading…
Reference in New Issue
Block a user