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>
diff --git a/manager.hpp b/manager.hpp
index d7282e6..c0c4249 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -2,6 +2,7 @@
#include <blobs-ipmid/blobs.hpp>
#include <ctime>
+#include <host-ipmid/oemrouter.hpp>
#include <memory>
#include <string>
#include <unordered_map>
@@ -10,6 +11,16 @@
namespace blobs
{
+/* The maximum read size.
+ * NOTE: Once this can be dynamically determined, we'll switch to that method.
+ * Having this in a header allows it to used cleanly for now.
+ */
+const int crcSize = sizeof(uint16_t);
+const int btReplyHdrLen = 5;
+const int btTransportLength = 64;
+const uint32_t maximumReadSize =
+ btTransportLength - (btReplyHdrLen + oem::groupMagicSize + crcSize);
+
struct SessionInfo
{
SessionInfo() = default;