mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 02:57:22 +00:00
fix segfault when incorrect oem option supplied
This commit is contained in:
parent
f63189780f
commit
fa21266ec2
@ -63,7 +63,7 @@ static struct ipmi_oem_handle ipmi_oem_list[] = {
|
|||||||
desc: "IBM OEM support",
|
desc: "IBM OEM support",
|
||||||
setup: ipmi_oem_ibm,
|
setup: ipmi_oem_ibm,
|
||||||
},
|
},
|
||||||
{ 0 },
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Supermicro IPMIv2 BMCs use OEM authtype */
|
/* Supermicro IPMIv2 BMCs use OEM authtype */
|
||||||
@ -110,7 +110,6 @@ int
|
|||||||
ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
||||||
{
|
{
|
||||||
struct ipmi_oem_handle * oem;
|
struct ipmi_oem_handle * oem;
|
||||||
int i;
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (strncmp(oemtype, "help", 4) == 0 ||
|
if (strncmp(oemtype, "help", 4) == 0 ||
|
||||||
@ -120,18 +119,13 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (oem=ipmi_oem_list, i=0; i < sizeof(ipmi_oem_list)/sizeof(struct ipmi_oem_handle); oem++, i++) {
|
for (oem=ipmi_oem_list; oem->name != NULL; oem++) {
|
||||||
if (oem->name == NULL)
|
|
||||||
continue;
|
|
||||||
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
|
if (strncmp(oemtype, oem->name, strlen(oem->name)) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oem->name == NULL) {
|
if (oem->name == NULL)
|
||||||
/* nothing was found */
|
|
||||||
lprintf(LOG_ERR, "OEM support not found for \"%s\"", oemtype);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
/* save pointer for later use */
|
/* save pointer for later use */
|
||||||
intf->oem = oem;
|
intf->oem = oem;
|
||||||
@ -164,4 +158,3 @@ ipmi_oem_active(struct ipmi_intf * intf, const char * oemtype)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user