1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

resolve: use memcmp_safe() and memcpy_safe()

As the length of salt in NSEC3 may be zero.

Fixes #9757.
This commit is contained in:
Yu Watanabe 2018-08-08 16:23:20 +09:00
parent f30faf854b
commit 1f66559ca2
2 changed files with 2 additions and 2 deletions

View File

@ -1380,7 +1380,7 @@ static int nsec3_is_good(DnsResourceRecord *rr, DnsResourceRecord *nsec3) {
return 0;
if (rr->nsec3.salt_size != nsec3->nsec3.salt_size)
return 0;
if (memcmp(rr->nsec3.salt, nsec3->nsec3.salt, rr->nsec3.salt_size) != 0)
if (memcmp_safe(rr->nsec3.salt, nsec3->nsec3.salt, rr->nsec3.salt_size) != 0)
return 0;
a = dns_resource_key_name(rr->key);

View File

@ -383,7 +383,7 @@ int dns_packet_append_blob(DnsPacket *p, const void *d, size_t l, size_t *start)
if (r < 0)
return r;
memcpy(q, d, l);
memcpy_safe(q, d, l);
return 0;
}