]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1955] Check for null options pointers.
authorMarcin Siodelski <marcin@isc.org>
Fri, 8 Jun 2012 16:09:54 +0000 (18:09 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 8 Jun 2012 16:09:54 +0000 (18:09 +0200)
tests/tools/perfdhcp/pkt_transform.cc

index 864fe65501e6d0b6aef071a948f7ed2a1e0f7669..5ed39bfc5f5d5849bdf94b589b18e4fa5b7ac928 100644 (file)
@@ -124,6 +124,9 @@ PktTransform::packOptions(const OptionBuffer& in_buffer,
             // Get options with their position (offset).
             boost::shared_ptr<LocalizedOption> option =
                 boost::dynamic_pointer_cast<LocalizedOption>(it->second);
+            if (option == NULL) {
+                isc_throw(isc::BadValue, "option is null");
+            }
             uint32_t offset = option->getOffset();
             if ((offset == 0) ||
                 (offset + option->len() > in_buffer.size())) {
@@ -160,6 +163,9 @@ PktTransform::unpackOptions(const OptionBuffer& in_buffer,
 
         boost::shared_ptr<LocalizedOption> option =
             boost::dynamic_pointer_cast<LocalizedOption>(it->second);
+        if (option == NULL) {
+            isc_throw(isc::BadValue, "option is null");
+        }
         size_t opt_pos = option->getOffset();
         if (opt_pos == 0) {
             isc_throw(isc::BadValue, "failed to unpack packet from raw buffer "