summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/actions.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b55a40..b1abee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);