diff --git a/bind.c b/bind.c index 53747b0..3fac657 100644 --- a/bind.c +++ b/bind.c @@ -444,7 +444,7 @@ unsigned int getckey(int mflag) /* check to see if we are executing a command line */ if (clexec) { - macarg(tok); /* get the next token */ + macarg( tok, sizeof tok) ; /* get the next token */ return stock(tok); } diff --git a/eval.c b/eval.c index 23a784f..2c31ba3 100644 --- a/eval.c +++ b/eval.c @@ -309,7 +309,6 @@ void varinit(void) char *gtfun(char *fname) { int fnum; /* index to function to eval */ - int status; /* return status */ char *tsp; /* temporary string pointer */ char arg1[NSTRING]; /* value of first argument */ char arg2[NSTRING]; /* value of second argument */ @@ -335,17 +334,17 @@ char *gtfun(char *fname) /* if needed, retrieve the first argument */ if (funcs[fnum].f_type >= MONAMIC) { - if ((status = macarg(arg1)) != TRUE) + if( macarg( arg1, sizeof arg1) != TRUE) return errorm; /* if needed, retrieve the second argument */ if (funcs[fnum].f_type >= DYNAMIC) { - if ((status = macarg(arg2)) != TRUE) + if( macarg( arg2, sizeof arg2) != TRUE) return errorm; /* if needed, retrieve the third argument */ if (funcs[fnum].f_type >= TRINAMIC) - if ((status = macarg(arg3)) != TRUE) + if( macarg( arg3, sizeof arg3) != TRUE) return errorm; } } diff --git a/exec.c b/exec.c index 1f3aa04..5864d79 100644 --- a/exec.c +++ b/exec.c @@ -167,7 +167,8 @@ static int docmd( char *cline) { lastflag = thisflag; thisflag = 0; - if ((status = macarg(tkn)) != TRUE) { /* and grab the first token */ + status = macarg( tkn, sizeof tkn) ; + if( status != TRUE) { /* and grab the first token */ execstr = oldestr; return status; } @@ -179,7 +180,8 @@ static int docmd( char *cline) { n = atoi(tkn); /* and now get the command to execute */ - if ((status = macarg(tkn)) != TRUE) { + status = macarg( tkn, sizeof tkn) ; + if( status != TRUE) { execstr = oldestr; return status; } @@ -282,14 +284,14 @@ char *token(char *src, char *tok, int size) * * char *tok; buffer to place argument */ -int macarg(char *tok) +int macarg( char *tok, int toksz) { boolean savcle ; /* buffer to store original clexec */ int status; savcle = clexec; /* save execution mode */ clexec = TRUE; /* get the argument */ - status = nextarg("", tok, NSTRING, ctoec('\n')); + status = nextarg("", tok, toksz, ctoec('\n')); clexec = savcle; /* restore execution mode */ return status; } @@ -748,7 +750,7 @@ static int dobuf(struct buffer *bp) case DIF: /* IF directive */ /* grab the value of the logical exp */ if (execlevel == 0) { - if (macarg(tkn) != TRUE) + if( macarg( tkn, sizeof tkn) != TRUE) goto eexec; if (stol(tkn) == FALSE) ++execlevel; @@ -759,7 +761,7 @@ static int dobuf(struct buffer *bp) case DWHILE: /* WHILE directive */ /* grab the value of the logical exp */ if (execlevel == 0) { - if (macarg(tkn) != TRUE) + if( macarg( tkn, sizeof tkn) != TRUE) goto eexec; if (stol(tkn) == TRUE) goto onward; diff --git a/exec.h b/exec.h index b5864bd..bddd85c 100644 --- a/exec.h +++ b/exec.h @@ -21,7 +21,7 @@ void ue_system( const char *cmd) ; int namedcmd( int f, int n) ; int execcmd( int f, int n) ; char *token( char *src, char *tok, int size) ; -int macarg( char *tok) ; +int macarg( char *tok, int toksz) ; int nextarg( const char *prompt, char *buffer, int size, int terminator) ; int storemac( int f, int n) ; int execbuf( int f, int n) ; diff --git a/input.c b/input.c index 20af126..15a0997 100644 --- a/input.c +++ b/input.c @@ -147,7 +147,7 @@ fn_t getname(void) /* if we are executing a command line get the next arg and match it */ if (clexec) { - if (macarg(buf) != TRUE) + if( macarg( buf, sizeof buf) != TRUE) return NULL; return fncmatch(&buf[0]); }