Two more null-pointer fixes to ipmi_lan.c, found in 2.0.16.

The first is in a debugging message in rmcpp_find_ipmi, which was using
the IPMI_CONN_NAME(ipmi) macro in a scenario in which the pointer it was
passing would always be NULL, causing a segfault.  I modified the debug
message to remove the connection name, as none of the other debug
messages in that function use the connection name anyway.

The second is in lan_oem_done, which may be called with a NULL "ipmi"
parameter (such as, indirectly, via lan_cleanup at line 4030).  It
contains recovery code for that purpose, but the initialization of "lan"
at line 4308 causes a segfault before the code gets to that point.  I
moved the initialization to after the test for NULL.

diff -Naur OpenIPMI-2.0.16-ORIGINAL/lib/ipmi_lan.c
OpenIPMI-2.0.16/lib/ipmi_lan.c
--- OpenIPMI-2.0.16-ORIGINAL/lib/ipmi_lan.c     2008-12-09
11:17:58.000000000 -0700
+++ OpenIPMI-2.0.16/lib/ipmi_lan.c      2009-06-16 16:03:37.000000000 -0600
@@ -3417,8 +3417,7 @@
     if (lan && addr_match_lan(lan, sid, addr, addr_num))
        ipmi = lan->ipmi;
     else if (DEBUG_RAWMSG || DEBUG_MSG_ERR)
-       ipmi_log(IPMI_LOG_DEBUG, "%stag doesn't match: %d",
-                IPMI_CONN_NAME(ipmi), tag);
+       ipmi_log(IPMI_LOG_DEBUG, "tag doesn't match: %d", tag);
     ipmi_unlock(item->con_lock);
 
     return ipmi;
@@ -4305,7 +4304,7 @@
 static void
 lan_oem_done(ipmi_con_t *ipmi, void *cb_data)
 {
-    lan_data_t  *lan = (lan_data_t *) ipmi->con_data;
+    lan_data_t  *lan;
     int         rv;
     ipmi_msgi_t *rspi = cb_data;
     int         addr_num = (long) rspi->data4;
@@ -4315,6 +4314,7 @@
        return;
     }
 
+    lan = (lan_data_t *) ipmi->con_data;
     rv = send_get_dev_id(ipmi, lan, addr_num, rspi);
     if (rv) {
         handle_connected(ipmi, rv, addr_num);

-- 
Eric J. Bowersox, Software Engineer     Aspen Systems, Inc.
<[email protected]>                      3900 Youngfield Street
Tel: +01 303 431 4606 x113              Wheat Ridge, CO  80033, USA
Fax: +01 303 431 7196                   <http://www.aspsys.com>

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to