diff options
author | Patrick Venture <venture@google.com> | 2019-02-01 14:44:15 -0800 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2019-02-01 15:13:43 -0800 |
commit | 86c87f55de9bb69f6e49c6203ffb0e12947ea7cf (patch) | |
tree | 243851da4f76e3d8f8c493de096dca8e670aad60 /manager.cpp | |
parent | dc82ab15f27ca4481518e9c151c20646d4afdc8b (diff) | |
download | phosphor-ipmi-blobs-86c87f55de9bb69f6e49c6203ffb0e12947ea7cf.tar.gz phosphor-ipmi-blobs-86c87f55de9bb69f6e49c6203ffb0e12947ea7cf.zip |
manager: add hard-coded read checks
The host-client cannot try to read back more than this number of bytes
without hitting a memory overflow in phosphor-host-ipmid. The method we
can call to dynamically receive that number isn't currently linking out
of the userlayer library.
Note: Once the configure_ac can find and provide the userlayer library
from phosphor-host-ipmid, we can remove the hard-coded 64 and 0xe.
Change-Id: I08f6bb59ce44279f76a494dccaa477ae75d532c4
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'manager.cpp')
-rw-r--r-- | manager.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/manager.cpp b/manager.cpp index 712d7db..639ca2d 100644 --- a/manager.cpp +++ b/manager.cpp @@ -270,8 +270,23 @@ std::vector<uint8_t> BlobManager::read(uint16_t session, uint32_t offset, return std::vector<uint8_t>(); } + /* TODO: Currently, configure_ac isn't finding libuserlayer, w.r.t the + * symbols I need. + */ + + /** The channel to use for now. + * TODO: We will receive this information through the IPMI message call. + */ + // const int ipmiChannel = ipmi::currentChNum; + /** This information is transport specific. + * TODO: We need a way to know this dynamically. + * on BT, 4 bytes of header, and 1 reply code. + */ + // uint32_t maxTransportSize = ipmi::getChannelMaxTransferSize(ipmiChannel); + /* Try reading from it. */ - return info->handler->read(session, offset, requestedSize); + return info->handler->read(session, offset, + std::min(maximumReadSize, requestedSize)); } bool BlobManager::write(uint16_t session, uint32_t offset, |