Fix a BSS buffer overflow caused by makeargv() writing past the end of
margv[] when an input line contains 20 or more space-separated words.
This commit is contained in:
parent
39c2840906
commit
ec7ac610f5
@ -59,7 +59,8 @@ int trace = 0;
|
||||
FILE *fd = 0;
|
||||
int margc;
|
||||
int fromatty;
|
||||
char *margv[20];
|
||||
#define MAX_MARGV 20
|
||||
char *margv[MAX_MARGV];
|
||||
char cmdline[200];
|
||||
jmp_buf toplevel;
|
||||
static struct cmd *getcmd __P((char *));
|
||||
@ -183,7 +184,7 @@ makeargv()
|
||||
register char **argp = margv;
|
||||
|
||||
margc = 0;
|
||||
for (cp = cmdline; *cp;) {
|
||||
for (cp = cmdline; margc < MAX_MARGV - 1 && *cp; ) {
|
||||
while (isspace(*cp))
|
||||
cp++;
|
||||
if (*cp == '\0')
|
||||
|
Loading…
Reference in New Issue
Block a user