mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
24005: enforce min/max arguments on zcurses commands.
This commit is contained in:
parent
52ea35c1c6
commit
526f86ec15
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,8 @@
|
||||||
2007-10-21 Clint Adams <clint@zsh.org>
|
2007-10-21 Clint Adams <clint@zsh.org>
|
||||||
|
|
||||||
|
* 24005: Src/Modules/curses.c: enforce min/max arguments on zcurses
|
||||||
|
commands.
|
||||||
|
|
||||||
* 24004: Doc/Zsh/mod_curses.yo: align documentation with UI changes
|
* 24004: Doc/Zsh/mod_curses.yo: align documentation with UI changes
|
||||||
in 24002.
|
in 24002.
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
{
|
{
|
||||||
char **saargs;
|
char **saargs;
|
||||||
struct zcurses_subcommand *zcsc;
|
struct zcurses_subcommand *zcsc;
|
||||||
int sc;
|
int sc, num_args;
|
||||||
|
|
||||||
struct zcurses_subcommand scs[] = {
|
struct zcurses_subcommand scs[] = {
|
||||||
{{"init", ZCURSES_SC_INIT}, 0, 0},
|
{{"init", ZCURSES_SC_INIT}, 0, 0},
|
||||||
|
@ -310,7 +310,13 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* here would be a good place to validate number of args */
|
saargs = args;
|
||||||
|
while (*saargs++);
|
||||||
|
num_args = saargs - (args + 2);
|
||||||
|
|
||||||
|
if (num_args < zcsc->minargs || num_args > zcsc->maxargs)
|
||||||
|
return 1;
|
||||||
|
|
||||||
saargs = args + 1;
|
saargs = args + 1;
|
||||||
|
|
||||||
/* Initialise curses */
|
/* Initialise curses */
|
||||||
|
|
Loading…
Reference in a new issue