Commit ce911b68 authored by Marcin Siodelski's avatar Marcin Siodelski

[1955] Check for null options pointers.

parent fa56b67f
...@@ -124,6 +124,9 @@ PktTransform::packOptions(const OptionBuffer& in_buffer, ...@@ -124,6 +124,9 @@ PktTransform::packOptions(const OptionBuffer& in_buffer,
// Get options with their position (offset). // Get options with their position (offset).
boost::shared_ptr<LocalizedOption> option = boost::shared_ptr<LocalizedOption> option =
boost::dynamic_pointer_cast<LocalizedOption>(it->second); boost::dynamic_pointer_cast<LocalizedOption>(it->second);
if (option == NULL) {
isc_throw(isc::BadValue, "option is null");
}
uint32_t offset = option->getOffset(); uint32_t offset = option->getOffset();
if ((offset == 0) || if ((offset == 0) ||
(offset + option->len() > in_buffer.size())) { (offset + option->len() > in_buffer.size())) {
...@@ -160,6 +163,9 @@ PktTransform::unpackOptions(const OptionBuffer& in_buffer, ...@@ -160,6 +163,9 @@ PktTransform::unpackOptions(const OptionBuffer& in_buffer,
boost::shared_ptr<LocalizedOption> option = boost::shared_ptr<LocalizedOption> option =
boost::dynamic_pointer_cast<LocalizedOption>(it->second); boost::dynamic_pointer_cast<LocalizedOption>(it->second);
if (option == NULL) {
isc_throw(isc::BadValue, "option is null");
}
size_t opt_pos = option->getOffset(); size_t opt_pos = option->getOffset();
if (opt_pos == 0) { if (opt_pos == 0) {
isc_throw(isc::BadValue, "failed to unpack packet from raw buffer " isc_throw(isc::BadValue, "failed to unpack packet from raw buffer "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment