From db33e7b11f3e289e3c8c012be4273736073693f3 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Sun, 4 Aug 2019 00:13:47 +0200 Subject: [PATCH] dnsdist: Fix signedness issue in isEDNSOptionInOpt() --- pdns/dnsdist-ecs.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pdns/dnsdist-ecs.cc b/pdns/dnsdist-ecs.cc index 5e8974d69..67fc57337 100644 --- a/pdns/dnsdist-ecs.cc +++ b/pdns/dnsdist-ecs.cc @@ -492,7 +492,7 @@ bool isEDNSOptionInOpt(const std::string& packet, const size_t optStart, const s return false; } size_t p = optStart + 9; - uint16_t rdLen = (0x100*packet.at(p) + packet.at(p+1)); + uint16_t rdLen = (0x100*static_cast(packet.at(p)) + static_cast(packet.at(p+1))); p += sizeof(rdLen); if (rdLen > (optLen - optRecordMinimumSize)) { return false; @@ -500,9 +500,9 @@ bool isEDNSOptionInOpt(const std::string& packet, const size_t optStart, const s size_t rdEnd = p + rdLen; while ((p + 4) <= rdEnd) { - const uint16_t optionCode = 0x100*packet.at(p) + packet.at(p+1); + const uint16_t optionCode = 0x100*static_cast(packet.at(p)) + static_cast(packet.at(p+1)); p += sizeof(optionCode); - const uint16_t optionLen = 0x100*packet.at(p) + packet.at(p+1); + const uint16_t optionLen = 0x100*static_cast(packet.at(p)) + static_cast(packet.at(p+1)); p += sizeof(optionLen); if ((p + optionLen) > rdEnd) { -- 2.49.0