]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge remote-tracking branch 'origin/master' into rec-edsn-unaligned-test 7698/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 10 Apr 2019 08:10:43 +0000 (10:10 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 10 Apr 2019 08:10:43 +0000 (10:10 +0200)
pdns/recursordist/test-ednsoptions_cc.cc

index d62a64c194c8cbd195db0c83d905585d048c9f2e..a49068f385fc43f02ce32239cf127d698e7d0f2f 100644 (file)
@@ -126,7 +126,9 @@ static void checkECSOptionValidity(const std::string& sourceStr, uint8_t sourceM
   uint8_t sourceBytes = ((sourceMask - 1) >> 3) + 1;
   BOOST_REQUIRE_EQUAL(ecsOptionStr.size(), (ecsHeaderSize + sourceBytes));
   /* family */
-  BOOST_REQUIRE_EQUAL(ntohs(*(reinterpret_cast<const uint16_t*>(&ecsOptionStr.at(0)))), source.isIPv4() ? 1 : 2);
+  uint16_t u;
+  memcpy(&u, ecsOptionStr.c_str(), sizeof(u));
+  BOOST_REQUIRE_EQUAL(ntohs(u), source.isIPv4() ? 1 : 2);
   /* source mask */
   BOOST_REQUIRE_EQUAL(static_cast<uint8_t>(ecsOptionStr.at(2)), sourceMask);
   BOOST_REQUIRE_EQUAL(static_cast<uint8_t>(ecsOptionStr.at(3)), scopeMask);