From 5dc9585e778e0fd5fa09c51db0cd11aabeeefb7d Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Sun, 8 Dec 2013 18:59:28 +0000 Subject: [PATCH] ID: 284 - Fix SEGV in ipmi_main Check the return code of ipmi_main_intf->open(), and take the error path if it fails. Right now we continue on blindly which results in a SEGV. Commit for Anton Blanchard --- ipmitool/lib/ipmi_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ipmitool/lib/ipmi_main.c b/ipmitool/lib/ipmi_main.c index 54b80c0..3d0a3b8 100644 --- a/ipmitool/lib/ipmi_main.c +++ b/ipmitool/lib/ipmi_main.c @@ -894,9 +894,11 @@ ipmi_main(int argc, char ** argv, /* Open the interface with the specified or default IPMB address */ ipmi_main_intf->my_addr = arg_addr ? arg_addr : IPMI_BMC_SLAVE_ADDR; - if (ipmi_main_intf->open != NULL) - ipmi_main_intf->open(ipmi_main_intf); - + if (ipmi_main_intf->open != NULL) { + if (ipmi_main_intf->open(ipmi_main_intf) < 0) { + goto out_free; + } + } /* * Attempt picmg discovery of the actual interface address unless * the users specified an address.