Skip to content
Snippets Groups Projects
Commit 06bf3a77 authored by Jakob Olsson's avatar Jakob Olsson Committed by Janusz Dziedzic
Browse files

controller_commands: enforce strict match on cmd lookup

parent 9b910e59
Branches
No related tags found
1 merge request!295wifi_opclass: add wifi_radio_opclass_update_channel
......@@ -944,8 +944,12 @@ struct controller_command *controller_command_lookup(const char *command)
struct controller_command *cmd = NULL;
for (int i = 0; i < num_cmds; i++) {
int len;
cmd = &cntlr_commandlist[i];
if (!strncmp(cmd->command, command, strlen(cmd->command)))
len = (strlen(cmd->command) > strlen(command) ?
strlen(cmd->command) : strlen(command));
if (!strncmp(cmd->command, command, len))
return cmd;
}
......@@ -963,8 +967,12 @@ int controller_command_get_policy(const char *command,
*policy = NULL;
for (int i = 0; i < num_cmds; i++) {
int len;
cmd = &cntlr_commandlist[i];
if (!strncmp(cmd->command, command, strlen(cmd->command))) {
len = (strlen(cmd->command) > strlen(command) ?
strlen(cmd->command) : strlen(command));
if (!strncmp(cmd->command, command, len)) {
struct blobmsg_policy *pol, *p;
if (!cmd->num_attrs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment