From: Francis Dupont Date: Thu, 21 Sep 2017 22:37:54 +0000 (+0200) Subject: [5227] Addressed review comments X-Git-Tag: trac5363_base~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2509c77bf8179453dcb181976459b436940ad867;p=thirdparty%2Fkea.git [5227] Addressed review comments --- diff --git a/src/lib/dhcp/option6_status_code.cc b/src/lib/dhcp/option6_status_code.cc index 9f68080e1b..b4cb2c4dbb 100644 --- a/src/lib/dhcp/option6_status_code.cc +++ b/src/lib/dhcp/option6_status_code.cc @@ -21,7 +21,7 @@ namespace { /// @brief Minimum length of the option (when status message is empty). const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t); -const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(bool); +const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(uint8_t); }; // end of anonymous namespace @@ -39,7 +39,7 @@ Option6StatusCode::Option6StatusCode(OptionBufferConstIter begin, : Option(Option::V6, D6O_STATUS_CODE), status_code_(STATUS_Success), status_message_() { - // Parse data + // Parse data unpack(begin, end); } @@ -149,7 +149,7 @@ Option4SlpServiceScope::Option4SlpServiceScope(OptionBufferConstIter begin, : Option(Option::V4, DHO_SERVICE_SCOPE), mandatory_flag_(false), scope_list_() { - // Parse data + // Parse data unpack(begin, end); } @@ -188,7 +188,7 @@ Option4SlpServiceScope::unpack(OptionBufferConstIter begin, OptionBufferConstIte isc_throw(BadDataTypeCast, "unable to read the buffer as boolean" << " value. Invalid value " << static_cast(*begin)); } - begin += sizeof(bool); + begin += sizeof(uint8_t); scope_list_.assign(begin, end); } diff --git a/src/lib/dhcp/option6_status_code.h b/src/lib/dhcp/option6_status_code.h index ceb14a89c4..0b96940422 100644 --- a/src/lib/dhcp/option6_status_code.h +++ b/src/lib/dhcp/option6_status_code.h @@ -50,6 +50,8 @@ public: /// @brief Parses received buffer. /// + /// @throw OutOfRange if specified option is truncated + /// /// @param begin Iterator to first byte of option data /// @param end Iterator to end of option data (first byte after option end) virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end); @@ -144,6 +146,9 @@ public: /// @brief Parses received buffer. /// + /// @throw OutOfRange if specified option is truncated + /// @throw BadDataTypeCast if first byte is not 0 or 1 + /// /// @param begin Iterator to first byte of option data /// @param end Iterator to end of option data (first byte after option end) virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);