summaryrefslogtreecommitdiffstats
path: root/include/ipmid/handler.hpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-08-22 14:41:50 -0700
committerTom Joseph <tomjoseph@in.ibm.com>2019-08-30 05:51:06 +0000
commit48408b6d85d1de60f9ff7a68a6c01585be50cf7b (patch)
treeaaa1641504d1f1b29acd26c4291647bdab2d538b /include/ipmid/handler.hpp
parent0a327e1ce11fb6ef083bffcbb5426e3d10542753 (diff)
downloadphosphor-host-ipmid-48408b6d85d1de60f9ff7a68a6c01585be50cf7b.tar.gz
phosphor-host-ipmid-48408b6d85d1de60f9ff7a68a6c01585be50cf7b.zip
legacy handlers need a bigger buffer
In the original ipmi execution queue, handlers were passed a larger buffer. The current code was only passing in the configured channel size, or 64 if no size was configured. This is too small and leads to buffer overflows for responses greater than 64 bytes. This brings the buffer sizes up to a point that matches the legacy code and to a size that is larger than any of IPMI standard transport sizes. Tested: used a bogus handler to create a large response and found that the entire response was returned. Change-Id: I91b359812247ae5fdef105c7b7a9dfe003548494 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'include/ipmid/handler.hpp')
-rw-r--r--include/ipmid/handler.hpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/ipmid/handler.hpp b/include/ipmid/handler.hpp
index 53b0bb8..10b7119 100644
--- a/include/ipmid/handler.hpp
+++ b/include/ipmid/handler.hpp
@@ -267,6 +267,7 @@ class IpmiHandler final : public HandlerBase
};
#ifdef ALLOW_DEPRECATED_API
+static constexpr size_t maxLegacyBufferSize = 64 * 1024;
/**
* @brief Legacy IPMI handler class
*
@@ -311,8 +312,7 @@ class IpmiHandler<ipmid_callback_t> final : public HandlerBase
{
message::Response::ptr response = request->makeResponse();
// allocate a big response buffer here
- response->payload.resize(
- getChannelMaxTransferSize(request->ctx->channel));
+ response->payload.resize(maxLegacyBufferSize);
size_t len = request->payload.size() - request->payload.rawIndex;
Cc ccRet{ccSuccess};
@@ -401,8 +401,7 @@ class IpmiHandler<oem::Handler> final : public HandlerBase
{
message::Response::ptr response = request->makeResponse();
// allocate a big response buffer here
- response->payload.resize(
- getChannelMaxTransferSize(request->ctx->channel));
+ response->payload.resize(maxLegacyBufferSize);
size_t len = request->payload.size() - request->payload.rawIndex;
Cc ccRet{ccSuccess};
OpenPOWER on IntegriCloud