diff options
author | sabetts <sabetts> | 2005-01-15 17:34:55 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2005-01-15 17:34:55 +0000 |
commit | 6e0af3d35f55833df7a9f31cd4a1888667a9b633 (patch) | |
tree | 52460814dc38cb755223f70a2a9cfa195da40026 | |
parent | 9376a79ac58a8953da9a3c7bed929165c7703e5c (diff) | |
download | ratpoison-6e0af3d35f55833df7a9f31cd4a1888667a9b633.zip |
(command): check list_size of head when checking for too many
arguments.
(cmd_set): raise error if set command was passed too many
arguments.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/actions.c | 7 |
2 files changed, 10 insertions, 1 deletions
@@ -3,6 +3,10 @@ * src/actions.c (init_user_commands): set the last argument of the following commands to arg_REST: addhook, chdir, remhook, source, tmpwm, and prompt. + (command): check list_size of head when checking for too many + arguments. + (cmd_set): raise error if set command was passed too many + arguments. 2005-01-15 Shawn Betts <sabetts@vcn.bc.ca> diff --git a/src/actions.c b/src/actions.c index 8d408f9..0d633b0 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2306,7 +2306,7 @@ command (int interactive, char *data) result = cmdret_new ("not enough arguments.", RET_FAILURE); goto free_lists; } - else if (list_size (&args) > uc->num_args) + else if (list_size (&head) > uc->num_args) { result = cmdret_new ("too many arguments.", RET_FAILURE); goto free_lists; @@ -4727,6 +4727,11 @@ cmd_set (int interactive, struct cmdarg **args) result = cmdret_new ("not enough arguments.", RET_FAILURE); goto failed; } + else if (list_size (&head) > ARG(0,variable)->nargs) + { + result = cmdret_new ("too many arguments.", RET_FAILURE); + goto failed; + } cmdargs = arg_array (&arglist); result = ARG(0,variable)->set_fn (cmdargs); |