]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5227] Addressed review comments
authorFrancis Dupont <fdupont@isc.org>
Thu, 21 Sep 2017 22:37:54 +0000 (00:37 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 21 Sep 2017 22:37:54 +0000 (00:37 +0200)
src/lib/dhcp/option6_status_code.cc
src/lib/dhcp/option6_status_code.h

index 9f68080e1be4645057b6fd747c9c225e6b3ffa99..b4cb2c4dbba869b5bfbe79cca44460dfc4e04bd8 100644 (file)
@@ -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<int>(*begin));
     }
-    begin += sizeof(bool);
+    begin += sizeof(uint8_t);
 
     scope_list_.assign(begin, end);
 }
index ceb14a89c4f7855e86a458df5778b3196a63f5f6..0b9694042274362df65f70dbdc9487a0bd1b64b0 100644 (file)
@@ -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);