2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

Add additional contraints to dns_rdata_checksvcb

REQUIRE that rdata->type is dns_rdatatype_svcb to detect when
dns_rdata_checksvcb is called with the wrong rdata type.  There are
no code paths that currently pass the wrong rdata to dns_rdata_checksvcb.

This was found by GCC 12 static analysis.
This commit is contained in:
Mark Andrews
2023-03-08 16:38:11 +11:00
parent f0c8da6d31
commit e37c9702ae
2 changed files with 2 additions and 1 deletions

View File

@@ -806,7 +806,7 @@ dns_rdata_checksvcb(const dns_name_t *owner, const dns_rdata_t *rdata);
* *
* Requires: * Requires:
*\li 'owner' is a valid name. *\li 'owner' is a valid name.
*\li 'rdata' is a valid, non-empty rdata. *\li 'rdata' is a valid, non-empty SVCB rdata.
* *
* Returns: * Returns:
*\li #ISC_R_SUCCESS -- success, the data is valid *\li #ISC_R_SUCCESS -- success, the data is valid

View File

@@ -2435,6 +2435,7 @@ dns_rdata_checksvcb(const dns_name_t *owner, const dns_rdata_t *rdata) {
REQUIRE(owner != NULL); REQUIRE(owner != NULL);
REQUIRE(rdata != NULL); REQUIRE(rdata != NULL);
REQUIRE(rdata->type == dns_rdatatype_svcb);
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
result = dns_rdata_tostruct(rdata, &svcb, NULL); result = dns_rdata_tostruct(rdata, &svcb, NULL);