Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: curses tweaks, maybe
- X-seq: zsh-workers 24005
- From: Clint Adams <clint@xxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxxxxx>
- Subject: Re: PATCH: curses tweaks, maybe
- Date: Sun, 21 Oct 2007 17:13:50 -0400
- In-reply-to: <20071020133709.GA15761@xxxxxxxxxxx>
- Mail-followup-to: Zsh Hackers' List <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20071017032955.GA25480@xxxxxxxxxxx> <20071017095724.44acafe1@news01> <200710170914.l9H9Eihs021321@xxxxxxxxxxxxxx> <071017075713.ZM30525@xxxxxxxxxxxxxxxxxxxxxx> <200710171505.l9HF5i6b025009@xxxxxxxxxxxxxx> <20071017152506.GA30012@xxxxxxxxxxx> <200710171539.l9HFdKWC025510@xxxxxxxxxxxxxx> <20071018204016.GA31055@xxxxxxxxxxx> <20071020131246.a5257ee6.p.w.stephenson@xxxxxxxxxxxx> <20071020133709.GA15761@xxxxxxxxxxx>
On Sat, Oct 20, 2007 at 09:37:09AM -0400, Clint Adams wrote:
> This needs the checking bit and a doc update.
This is probably not the most efficient.
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.15
diff -u -r1.15 curses.c
--- Src/Modules/curses.c 20 Oct 2007 13:40:02 -0000 1.15
+++ Src/Modules/curses.c 21 Oct 2007 21:08:54 -0000
@@ -281,7 +281,7 @@
{
char **saargs;
struct zcurses_subcommand *zcsc;
- int sc;
+ int sc, num_args;
struct zcurses_subcommand scs[] = {
{{"init", ZCURSES_SC_INIT}, 0, 0},
@@ -310,7 +310,13 @@
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;
/* Initialise curses */
- References:
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
- Re: PATCH: curses tweaks, maybe
Messages sorted by:
Reverse Date,
Date,
Thread,
Author