Exit on bad maxadmin arguments
The errors were detected but the code proceeded to call various functions with bad pointers. This led to a crash if a bad server name was given to 'show server'.
This commit is contained in:
@ -1755,6 +1755,7 @@ execute_cmd(CLI_SESSION *cli)
|
||||
else
|
||||
{
|
||||
unsigned long arg_list[MAXARGS] = {};
|
||||
bool ok = true;
|
||||
|
||||
for (int k = 0; k < cmds[i].options[j].argc_max && k < argc; k++)
|
||||
{
|
||||
@ -1762,10 +1763,12 @@ execute_cmd(CLI_SESSION *cli)
|
||||
if (arg_list[k] == 0)
|
||||
{
|
||||
dcb_printf(dcb, "Invalid argument: %s\n", args[k + 2]);
|
||||
break;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
switch (cmds[i].options[j].argc_max)
|
||||
{
|
||||
case 0:
|
||||
@ -1832,6 +1835,7 @@ execute_cmd(CLI_SESSION *cli)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
dcb_printf(dcb,
|
||||
|
||||
Reference in New Issue
Block a user