[Skiboot] [PATCH 12/51] libflash/ipmi-hiomap: Enforce message size for empty response

Andrew Jeffery andrew at aj.id.au
Fri Feb 15 17:56:29 AEDT 2019


Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 libflash/ipmi-hiomap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index c787da4d3c88..86e47396efba 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -205,6 +205,12 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 	case HIOMAP_C_FLUSH:
 	case HIOMAP_C_ACK:
 	case HIOMAP_C_ERASE:
+		if (msg->resp_size != 2) {
+			prerror("%u: Unexpected response size: %u\n", msg->data[0],
+				msg->resp_size);
+			res->cc = IPMI_ERR_UNSPECIFIED;
+			break;
+		}
 		break;
 	default:
 		prlog(PR_WARNING, "Unimplemented command handler: %u\n",
-- 
2.19.1



More information about the Skiboot mailing list