]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#599,!320] Protect against null ptr dereferencing in HTTP log messages.
authorMarcin Siodelski <marcin@isc.org>
Tue, 14 May 2019 07:41:13 +0000 (09:41 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 14 May 2019 07:41:13 +0000 (09:41 +0200)
As a result of review.

src/lib/http/client.cc

index 91359e47f9ee8519ffa01a2d2e61dab975ccc26b..971e493e11a3238d9323b8a1ca492f10d01b73ac 100644 (file)
@@ -587,7 +587,8 @@ Connection::terminate(const boost::system::error_code& ec,
             LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA,
                       HTTP_SERVER_RESPONSE_RECEIVED_DETAILS)
                 .arg(url_.toText())
-                .arg(parser_->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE));
+                .arg((parser_ ? parser_->getBufferAsString(MAX_LOGGED_MESSAGE_SIZE)
+                      : "[HttpResponseParser is null]"));
 
         } else {
             std::string err = parsing_error.empty() ? ec.message() : parsing_error;
@@ -603,7 +604,8 @@ Connection::terminate(const boost::system::error_code& ec,
                 LOG_DEBUG(http_logger, isc::log::DBGLVL_TRACE_BASIC_DATA,
                           HTTP_BAD_SERVER_RESPONSE_RECEIVED_DETAILS)
                     .arg(url_.toText())
-                    .arg(parser_->getBufferAsString());
+                    .arg((parser_ ? parser_->getBufferAsString()
+                          : "[HttpResponseParser is null]"));
             }
         }