diff --git a/docs/manpages/sdig.1.rst b/docs/manpages/sdig.1.rst index 996d5ca6ad07..25ee18a6c08a 100644 --- a/docs/manpages/sdig.1.rst +++ b/docs/manpages/sdig.1.rst @@ -58,7 +58,7 @@ tlsProvider *name* opcode *OPNUM* Use opcode *OPNUM* instead of 0 (Query). For example, ``sdig 192.0.2.1 53 example.com SOA opcode 4`` sends a ``NOTIFY``. cookie *COOKIE* - if *COOKIE* is -d send a random client cookie. Otherwise send the given cookie, which should be a hex string received from a server earlier. + if *COOKIE* is - send a random client cookie. Otherwise send the given cookie, which should be a hex string received from a server earlier. Examples -------- diff --git a/pdns/ednscookies.cc b/pdns/ednscookies.cc index 253d9bab8ca0..c390865ef7a0 100644 --- a/pdns/ednscookies.cc +++ b/pdns/ednscookies.cc @@ -151,9 +151,9 @@ void EDNSCookiesOpt::makeClientCookie() uint32_t lower = dns_random_uint32(); uint32_t upper = dns_random_uint32(); client = string(); - client.resize(8); + client.resize(sizeof(lower) + sizeof(upper)); memcpy(client.data(), &lower, sizeof(lower)); - memcpy(&client.at(4), &upper, sizeof(upper)); + memcpy(&client.at(sizeof(lower)), &upper, sizeof(upper)); } bool EDNSCookiesOpt::makeServerCookie([[maybe_unused]] const string& secret, [[maybe_unused]] const ComboAddress& source) diff --git a/pdns/sdig.cc b/pdns/sdig.cc index 291b3f1a3889..065e65e7878a 100644 --- a/pdns/sdig.cc +++ b/pdns/sdig.cc @@ -63,8 +63,8 @@ static void fillPacket(vector& packet, const string& q, const string& t { DNSPacketWriter pw(packet, DNSName(q), DNSRecordContent::TypeToNumber(t), qclass, opcode); - if (dnssec || ednsnm || getenv("SDIGBUFSIZE") != nullptr || cookie) { // NOLINT(concurrency-mt-unsafe) we'resingle threaded - char* sbuf = getenv("SDIGBUFSIZE"); // NOLINT(concurrency-mt-unsafe) we'resingle threaded + if (dnssec || ednsnm || getenv("SDIGBUFSIZE") != nullptr || cookie) { // NOLINT(concurrency-mt-unsafe) we're single threaded + char* sbuf = getenv("SDIGBUFSIZE"); // NOLINT(concurrency-mt-unsafe) we're single threaded int bufsize; if (sbuf) bufsize = atoi(sbuf); @@ -246,7 +246,7 @@ try { bool dumpluaraw = false; std::optional cookie; - // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, concurrency-mt-unsafe) it's the argv API and w're single-threaded + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, concurrency-mt-unsafe) it's the argv API and we're single-threaded for (int i = 1; i < argc; i++) { if ((string)argv[i] == "--help") { usage();