mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Fixes bug ID:3484936 - missing user input validation in 'lib/ipmi_session.c'
It replaces strtol() calls with str2uint() ones and adds error messages if invalid input is given.
This commit is contained in:
parent
78d7ae8d88
commit
bb632de830
@ -400,7 +400,12 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
if (argc >= 3)
|
||||
{
|
||||
session_request_type = IPMI_SESSION_REQUEST_BY_ID;
|
||||
id_or_handle = strtol(argv[2], NULL, 16);
|
||||
if (str2uint(argv[2], &id_or_handle) != 0) {
|
||||
lprintf(LOG_ERR, "HEX number expected, but '%s' given.",
|
||||
argv[2]);
|
||||
printf_session_usage();
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -414,7 +419,12 @@ ipmi_session_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
if (argc >= 3)
|
||||
{
|
||||
session_request_type = IPMI_SESSION_REQUEST_BY_HANDLE;
|
||||
id_or_handle = strtol(argv[2], NULL, 16);
|
||||
if (str2uint(argv[2], &id_or_handle) != 0) {
|
||||
lprintf(LOG_ERR, "HEX number expected, bud '%s' given.",
|
||||
argv[2]);
|
||||
printf_session_usage();
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user