Recover Add ipmi response buffer size check for all commands

Use the ipmi::Context channel to get the max transfer size to make sure
that we select the right size.

Also remove maximumReadSize since the max reply size is checked instead

We already check the max reply size so maximumReadSize is not needed
anymore. This will result in a bit of a different behavior when the size
exceed the max. It will not fail - instead, it will return up to the
max size.

Tested:
Work with ipmi config that doesn't support the default interface (13).
```
cat /usr/share/ipmi-providers/channel_config.json
{
  "0": {
    "name": "usb0",
    "is_valid": true,
    "active_sessions": 0,
    "channel_info": {
      "medium_type": "lan-802.3",
      "protocol_type": "ipmb-1.0",
      "session_supported": "multi-session",
      "is_ipmi": true
    }
  },
  "8": {
    "name": "INTRABMC",
    "is_valid": true,
    "active_sessions": 0,
    "channel_info": {
      "medium_type": "oem",
      "protocol_type": "oem",
      "session_supported": "session-less",
      "is_ipmi": true
    }
  },
  "11": {
    "name": "gbmcbr",
    "is_valid": true,
    "active_sessions": 0,
    "channel_info": {
      "medium_type": "lan-802.3",
      "protocol_type": "ipmb-1.0",
      "session_supported": "multi-session",
      "is_ipmi": true
    }
  }
}
```

This read the blob count and always works now since it uses the right
interface to get the max transfer size.
```
ipmitool raw 46 128 207 194 0 0
 cf c2 00 4a ac 0e 00 00 00
```

Change-Id: Ia65f80719a819e7d642eb7425463a56c179935ac
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/test/process_unittest.cpp b/test/process_unittest.cpp
index 02014d4..1a0d6e4 100644
--- a/test/process_unittest.cpp
+++ b/test/process_unittest.cpp
@@ -168,7 +168,7 @@
     };
 
     EXPECT_EQ(ipmi::responseInvalidCommand(),
-              processBlobCommand(h, &manager, request));
+              processBlobCommand(h, &manager, request, MAX_IPMI_BUFFER));
 }
 
 TEST_F(ProcessBlobCommandTest, CommandReturnsOkWithNoPayload)
@@ -184,7 +184,7 @@
     };
 
     EXPECT_EQ(ipmi::responseSuccess(std::vector<uint8_t>()),
-              processBlobCommand(h, &manager, request));
+              processBlobCommand(h, &manager, request, MAX_IPMI_BUFFER));
 }
 
 TEST_F(ProcessBlobCommandTest, CommandReturnsOkWithInvalidPayloadLength)
@@ -200,7 +200,7 @@
     };
 
     EXPECT_EQ(ipmi::responseUnspecifiedError(),
-              processBlobCommand(h, &manager, request));
+              processBlobCommand(h, &manager, request, MAX_IPMI_BUFFER));
 }
 
 TEST_F(ProcessBlobCommandTest, CommandReturnsOkWithValidPayloadLength)
@@ -221,10 +221,31 @@
 
     EXPECT_CALL(crcMock, generateCrc(_)).WillOnce(Return(0x3412));
 
-    auto result = validateReply(processBlobCommand(h, &manager, request));
+    auto result = validateReply(
+        processBlobCommand(h, &manager, request, MAX_IPMI_BUFFER));
 
     EXPECT_EQ(result.size(), payloadLen);
     EXPECT_THAT(result, ElementsAre(0x12, 0x34, 0x56));
 }
 
+TEST_F(ProcessBlobCommandTest,
+       CommandReturnsErrorWithReplyExceededMaxTransferSize)
+{
+    // There is a minimum payload length of 3 bytes, this command returns a
+    // payload of 3 bytes and the crc code is called to process the payload.
+
+    StrictMock<ManagerMock> manager;
+    std::vector<uint8_t> request(MAX_IPMI_BUFFER - 1);
+    uint32_t payloadLen = sizeof(uint16_t) + sizeof(uint8_t);
+
+    IpmiBlobHandler h = [payloadLen](ManagerInterface*,
+                                     std::span<const uint8_t>) {
+        std::vector<uint8_t> output(payloadLen, 0);
+        output[2] = 0x56;
+        return ipmi::responseSuccess(output);
+    };
+
+    EXPECT_EQ(ipmi::responseResponseError(),
+              processBlobCommand(h, &manager, request, 0));
+}
 } // namespace blobs