Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • BIND BIND
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 633
    • Issues 633
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 87
    • Merge requests 87
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • BINDBIND
  • Issues
  • #2011
Closed
Open
Issue created Jul 07, 2020 by Michael McNally@McNally

Off-by-one error in dns_rdatatype_attributes?

On Support #16775, Jinmei writes to let us know:

I happened to notice one very minor "off-by-one" glitch in lib/dns/rdata.c:dns_rdatatype_attributes, which would be fixed by the following patch. That is, I believe including 255 is more logical according to the meta type range specified by IANA: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4

This doesn't affect the behavior anyway (hence "very minor"), since RDATATYPE_ATTRIBUTE_SW covers the case of type == 255. But the "fixed" code would be less confusing for code readers.

(BTW: If 255 was intentionally excluded because the type is not "UNKNOWN", I'd say 249-254 should also be excluded).

diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index c8453aae5c..7a281c2ef7 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -1286,7 +1286,7 @@ dns_rdata_checknames(dns_rdata_t *rdata, const dns_name_t *owner,
unsigned int
dns_rdatatype_attributes(dns_rdatatype_t type) {
RDATATYPE_ATTRIBUTE_SW
- if (type >= (dns_rdatatype_t)128 && type < (dns_rdatatype_t)255) {
+ if (type >= (dns_rdatatype_t)128 && type <= (dns_rdatatype_t)255) {
return (DNS_RDATATYPEATTR_UNKNOWN | DNS_RDATATYPEATTR_META);
}
return (DNS_RDATATYPEATTR_UNKNOWN);

Has he discovered an error on our part or was this done intentionally (in which case, can we explain why?)

Assignee
Assign to
Time tracking