From a9f7a7b92e8ba876a206fa02280ac87c50a79b64 Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Fri, 19 Oct 2012 07:01:40 +0000 Subject: [PATCH] ID: 3578277 - 'lib/ipmi_fru.c' - possible NULL pointer Commit fixes possible NULL pointer by adding check whether fru_bloc, returned from build_fru_bloc(), is NULL or not. If it is, print an error message and return (-1). --- ipmitool/lib/ipmi_fru.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ipmitool/lib/ipmi_fru.c b/ipmitool/lib/ipmi_fru.c index 9a26f77..56b2c65 100644 --- a/ipmitool/lib/ipmi_fru.c +++ b/ipmitool/lib/ipmi_fru.c @@ -497,6 +497,11 @@ write_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id, t_ipmi_fru_bloc * fru_bloc = build_fru_bloc(intf, fru, id, &num_bloc); + if (fru_bloc == NULL) { + lprintf(LOG_ERROR, "Failed to build FRU bloc."); + return (-1); + } + memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_STORAGE; req.msg.cmd = SET_FRU_DATA;