etherswitchcfg(8) crashes when you don't set vlangroup members.

Fix this to require an argument.

PR:		kern/177872
Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
This commit is contained in:
Adrian Chadd 2013-04-22 05:30:20 +00:00
parent e1d6379074
commit cdf0868a3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249748

View File

@ -467,8 +467,11 @@ main(int argc, char *argv[])
case MODE_PORT:
case MODE_VLANGROUP:
for(i=0; cmds[i].name != NULL; i++) {
if (cfg.mode == cmds[i].mode && strcmp(argv[0], cmds[i].name) == 0
&& argc >= cmds[i].args) {
if (cfg.mode == cmds[i].mode && strcmp(argv[0], cmds[i].name) == 0) {
if (argc < (cmds[i].args + 1)) {
printf("%s needs an argument\n", cmds[i].name);
break;
}
(cmds[i].f)(&cfg, argv);
argc -= cmds[i].args;
argv += cmds[i].args;