From 6e0af3d35f55833df7a9f31cd4a1888667a9b633 Mon Sep 17 00:00:00 2001 From: sabetts Date: Sat, 15 Jan 2005 17:34:55 +0000 Subject: (command): check list_size of head when checking for too many arguments. (cmd_set): raise error if set command was passed too many arguments. --- ChangeLog | 4 ++++ src/actions.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 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); -- cgit v1.2.3