From: Peter van Dijk Date: Thu, 1 Apr 2021 11:37:41 +0000 (+0200) Subject: rfc6742 types: use correct size X-Git-Tag: dnsdist-1.6.0-rc1~23^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c510d90714b7a5f3191578599ee34cfdcbee217;p=thirdparty%2Fpdns.git rfc6742 types: use correct size --- diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index 775793dcd0..bcb2884779 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -142,7 +142,7 @@ template void GenericDNSPacketWriter::xfr48BitIn template void GenericDNSPacketWriter::xfrNodeOrLocatorID(NodeOrLocatorID val) { - d_content.insert(d_content.end(), val, val + sizeof(val)); + d_content.insert(d_content.end(), val.content, val.content + sizeof(val.content)); } template void GenericDNSPacketWriter::xfr32BitInt(uint32_t val) diff --git a/pdns/misc.hh b/pdns/misc.hh index 4303ded544..44d4482870 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -630,4 +630,4 @@ size_t parseSVCBValueList(const std::string &in, vector &val); std::string makeLuaString(const std::string& in); // Used in NID and L64 records -typedef uint8_t NodeOrLocatorID[8]; +struct NodeOrLocatorID { uint8_t content[8]; }; diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index a0c7468eab..20f707cb0c 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -601,7 +601,7 @@ void RecordTextWriter::xfrNodeOrLocatorID(const NodeOrLocatorID& val) size_t ctr = 0; char tmp[5]; - for (auto const &c : val) { + for (auto const &c : val.content) { snprintf(tmp, sizeof(tmp), "%02X", c); d_string+=tmp; ctr++; diff --git a/pdns/test-rcpgenerator_cc.cc b/pdns/test-rcpgenerator_cc.cc index b1738cf9d7..e2fd947d83 100644 --- a/pdns/test-rcpgenerator_cc.cc +++ b/pdns/test-rcpgenerator_cc.cc @@ -385,14 +385,14 @@ BOOST_AUTO_TEST_CASE(test_xfrNodeOrLocatorID) { RecordTextReader rtr(source); NodeOrLocatorID v; rtr.xfrNodeOrLocatorID(v); - BOOST_CHECK_EQUAL(v[0], 0); - BOOST_CHECK_EQUAL(v[1], 0); - BOOST_CHECK_EQUAL(v[2], 0); - BOOST_CHECK_EQUAL(v[3], 0); - BOOST_CHECK_EQUAL(v[4], 0); - BOOST_CHECK_EQUAL(v[5], 0); - BOOST_CHECK_EQUAL(v[6], 0); - BOOST_CHECK_EQUAL(v[7], 1); + BOOST_CHECK_EQUAL(v.content[0], 0); + BOOST_CHECK_EQUAL(v.content[1], 0); + BOOST_CHECK_EQUAL(v.content[2], 0); + BOOST_CHECK_EQUAL(v.content[3], 0); + BOOST_CHECK_EQUAL(v.content[4], 0); + BOOST_CHECK_EQUAL(v.content[5], 0); + BOOST_CHECK_EQUAL(v.content[6], 0); + BOOST_CHECK_EQUAL(v.content[7], 1); string target; RecordTextWriter rtw(target);