core: Check Null pointer in mctp_bridge_busses()
Handle memory allocation failures in mctp_bridge_busses to
reduce the likelihood of a possible attack.
Change-Id: Ib8edc94ae5942dc1c0b2355aeb3642d079512537
Signed-off-by: Helen Huang <he.huang@linux.intel.com>
diff --git a/core.c b/core.c
index 2ec9046..5ec4fcb 100644
--- a/core.c
+++ b/core.c
@@ -363,6 +363,8 @@
assert(mctp->n_busses == 0);
mctp->busses = __mctp_alloc(2 * sizeof(struct mctp_bus));
+ if (!mctp->busses)
+ return -ENOMEM;
memset(mctp->busses, 0, 2 * sizeof(struct mctp_bus));
mctp->n_busses = 2;
mctp->busses[0].binding = b1;