mirror of https://gerrit.osmocom.org/libosmocore
ctrl: Avoid accessing cmd_desc->command out of bounds
We check that the amount of commands is not more than we have but we don't check it the other way. It appears that the vector is allowed to be bigger than the amount of commands. So we match a prefix of a longer command depending on the installation order.
This commit is contained in:
parent
4e0543f730
commit
5fb265eaa7
|
@ -86,7 +86,7 @@ static struct ctrl_cmd_element *ctrl_cmd_get_element_match(vector vline, vector
|
|||
cmd_desc = &cmd_el->strcmd;
|
||||
if (cmd_desc->nr_commands > vector_active(vline))
|
||||
continue;
|
||||
for (j =0; j < vector_active(vline); j++) {
|
||||
for (j =0; j < vector_active(vline) && j < cmd_desc->nr_commands; j++) {
|
||||
str = vector_slot(vline, j);
|
||||
desc = cmd_desc->command[j];
|
||||
if (desc[0] == '*')
|
||||
|
|
Loading…
Reference in New Issue