ID: 3528308 - 'lib/ipmi_hpmfwupg.c' - possible int *flow

Commit replaces atoi() call with str2int() and puts a limit on accepted values
for Component ID to <0..7>.
This commit is contained in:
Zdenek Styblik 2013-08-12 17:49:07 +00:00
parent 8e94374cf1
commit bfba2f83f5

View File

@ -3855,7 +3855,13 @@ int ipmi_hpmfwupg_main(struct ipmi_intf * intf, int argc, char ** argv)
{
if (i+1 < argc)
{
componentId = atoi(argv[i+1]);
if (str2int(argv[i+1], &componentId) != 0 ||
componentId < 0 || componentId > 7) {
lprintf(LOG_ERR, "Given Component ID '%s' is invalid.",
argv[i+1]);
lprintf(LOG_ERR, "Valid Compoment ID is: <0..7>");
return (-1);
}
option &= ~(VERSIONCHECK_MODE);
option &= ~(VIEW_MODE);
option |= FORCE_MODE_COMPONENT;