ID: 3600927 - change eval order of input param in ipmi_oem_setup()

Commit changes evaluation order of 'oemtype' which is an input parameter to
ipmi_oem_setup() in 'lib/ipmi_oem.c'. Make the check whether 'oemtype' is NULL
or not one of the first things we do rather than blindly use 'oemtype' in
strncmp() and then check if it isn't NULL. Yes, this is a potential crash
waiting to happen.

Reported-by: Ales Ledvinka
This commit is contained in:
Zdenek Styblik 2013-02-12 12:01:32 +00:00
parent 5fa202f7d3
commit 69e43dc87f

View File

@ -112,9 +112,9 @@ ipmi_oem_setup(struct ipmi_intf * intf, char * oemtype)
struct ipmi_oem_handle * oem; struct ipmi_oem_handle * oem;
int rc = 0; int rc = 0;
if (strncmp(oemtype, "help", 4) == 0 || if (oemtype == NULL ||
strncmp(oemtype, "list", 4) == 0 || strncmp(oemtype, "help", 4) == 0 ||
oemtype == NULL) { strncmp(oemtype, "list", 4) == 0) {
ipmi_oem_print(); ipmi_oem_print();
return -1; return -1;
} }