ash: fix miscalculation of memory needed for eval tree
found by Timo Teras (timo.teras AT iki.fi)
This commit is contained in:
parent
b8baf407aa
commit
340299a8bc
56
shell/ash.c
56
shell/ash.c
@ -536,6 +536,7 @@ static const char dolatstr[] ALIGN1 = {
|
||||
#define NHERE 24
|
||||
#define NXHERE 25
|
||||
#define NNOT 26
|
||||
#define N_NUMBER 27
|
||||
|
||||
union node;
|
||||
|
||||
@ -7556,33 +7557,34 @@ static char *funcstring; /* block to allocate strings from */
|
||||
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
|
||||
#define EV_BACKCMD 04 /* command executing within back quotes */
|
||||
|
||||
static const short nodesize[26] = {
|
||||
SHELL_ALIGN(sizeof(struct ncmd)),
|
||||
SHELL_ALIGN(sizeof(struct npipe)),
|
||||
SHELL_ALIGN(sizeof(struct nredir)),
|
||||
SHELL_ALIGN(sizeof(struct nredir)),
|
||||
SHELL_ALIGN(sizeof(struct nredir)),
|
||||
SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
SHELL_ALIGN(sizeof(struct nif)),
|
||||
SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
SHELL_ALIGN(sizeof(struct nfor)),
|
||||
SHELL_ALIGN(sizeof(struct ncase)),
|
||||
SHELL_ALIGN(sizeof(struct nclist)),
|
||||
SHELL_ALIGN(sizeof(struct narg)),
|
||||
SHELL_ALIGN(sizeof(struct narg)),
|
||||
SHELL_ALIGN(sizeof(struct nfile)),
|
||||
SHELL_ALIGN(sizeof(struct nfile)),
|
||||
SHELL_ALIGN(sizeof(struct nfile)),
|
||||
SHELL_ALIGN(sizeof(struct nfile)),
|
||||
SHELL_ALIGN(sizeof(struct nfile)),
|
||||
SHELL_ALIGN(sizeof(struct ndup)),
|
||||
SHELL_ALIGN(sizeof(struct ndup)),
|
||||
SHELL_ALIGN(sizeof(struct nhere)),
|
||||
SHELL_ALIGN(sizeof(struct nhere)),
|
||||
SHELL_ALIGN(sizeof(struct nnot)),
|
||||
static const short nodesize[N_NUMBER] = {
|
||||
[NCMD ] = SHELL_ALIGN(sizeof(struct ncmd)),
|
||||
[NPIPE ] = SHELL_ALIGN(sizeof(struct npipe)),
|
||||
[NREDIR ] = SHELL_ALIGN(sizeof(struct nredir)),
|
||||
[NBACKGND ] = SHELL_ALIGN(sizeof(struct nredir)),
|
||||
[NSUBSHELL] = SHELL_ALIGN(sizeof(struct nredir)),
|
||||
[NAND ] = SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
[NOR ] = SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
[NSEMI ] = SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
[NIF ] = SHELL_ALIGN(sizeof(struct nif)),
|
||||
[NWHILE ] = SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
[NUNTIL ] = SHELL_ALIGN(sizeof(struct nbinary)),
|
||||
[NFOR ] = SHELL_ALIGN(sizeof(struct nfor)),
|
||||
[NCASE ] = SHELL_ALIGN(sizeof(struct ncase)),
|
||||
[NCLIST ] = SHELL_ALIGN(sizeof(struct nclist)),
|
||||
[NDEFUN ] = SHELL_ALIGN(sizeof(struct narg)),
|
||||
[NARG ] = SHELL_ALIGN(sizeof(struct narg)),
|
||||
[NTO ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NTO2 ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NCLOBBER ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NFROM ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NFROMTO ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NAPPEND ] = SHELL_ALIGN(sizeof(struct nfile)),
|
||||
[NTOFD ] = SHELL_ALIGN(sizeof(struct ndup)),
|
||||
[NFROMFD ] = SHELL_ALIGN(sizeof(struct ndup)),
|
||||
[NHERE ] = SHELL_ALIGN(sizeof(struct nhere)),
|
||||
[NXHERE ] = SHELL_ALIGN(sizeof(struct nhere)),
|
||||
[NNOT ] = SHELL_ALIGN(sizeof(struct nnot)),
|
||||
};
|
||||
|
||||
static void calcsize(union node *n);
|
||||
|
Loading…
Reference in New Issue
Block a user