]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
[clang-tidy:array] in dnsparser.cc use std::array.
authorAxel Viala <axel.viala@darnuria.eu>
Thu, 6 Oct 2022 11:33:02 +0000 (13:33 +0200)
committerAxel Viala <axel.viala@darnuria.eu>
Sat, 24 Dec 2022 13:36:19 +0000 (14:36 +0100)
Review by @omoerbeek: Fix size inconsistancy.

pdns/dnsparser.cc

index 242c9aa48ae70b35c4b2e47ceffba048d18cf8ce..1da22324222977b3f55fd0b809fae892b560df63 100644 (file)
@@ -96,8 +96,8 @@ shared_ptr<DNSRecordContent> DNSRecordContent::deserialize(const DNSName& qname,
 
   memcpy(&packet[0], &dnsheader, sizeof(dnsheader)); pos+=sizeof(dnsheader);
 
-  char tmp[6]="\x0" "\x0\x1" "\x0\x1"; // root question for ns_t_a
-  memcpy(&packet[pos], &tmp, 5); pos+=5;
+  constexpr std::array<uint8_t, 5> tmp= {'\x0', '\x0', '\x1', '\x0', '\x1' }; // root question for ns_t_a
+  memcpy(&packet[pos], tmp.data(), tmp.size()); pos += tmp.size();
 
   memcpy(&packet[pos], encoded.c_str(), encoded.size()); pos+=(uint16_t)encoded.size();