Skip to content

Commit

Permalink
[noup] zephyr: fix hostapd_cli set command parse wrong in zephyr
Browse files Browse the repository at this point in the history
hostapd_config_parse_key_mgmt can parse more than two argcs.
And hostapd_cli shell command has one more "interactive" argv,
which makes argc not equal to 2.
So align with wpa_cli_cmd_set.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
  • Loading branch information
fengming-ye authored and jukkar committed Sep 12, 2024
1 parent 18572ff commit cbae017
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions hostapd/hostapd_cli_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,21 @@ static int hostapd_cli_cmd(struct wpa_ctrl *ctrl, const char *cmd,

}


static int hostapd_cli_cmd_set(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[2048];
int res;
char cmd[256];
int res;

if (argc != 2) {
printf("Invalid SET command: needs two arguments (variable "
"name and value)\n");
return -1;
}
if (argc == 1) {
res = os_snprintf(cmd, sizeof(cmd), "SET %s ", argv[0]);
if (os_snprintf_error(sizeof(cmd), res)) {
wpa_printf(MSG_INFO, "Too long SET command.\n");
return -1;
}
return hostapd_cli_cmd(ctrl, cmd, 0, argc, argv);
}

res = os_snprintf(cmd, sizeof(cmd), "SET %s %s", argv[0], argv[1]);
if (os_snprintf_error(sizeof(cmd), res)) {
printf("Too long SET command.\n");
return -1;
}
return hostapd_ctrl_command(ctrl, cmd);
return hostapd_cli_cmd(ctrl, "SET", 2, argc, argv);
}


Expand Down

0 comments on commit cbae017

Please sign in to comment.