Fix uninitialized variable
echo | awk 'BEGIN {i=$1; print i}' prints a boatload of stack garbage. NUL terminate the memory returned from malloc to prevent it. Obtained from: OpenBSD run.c 1.40 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12379
This commit is contained in:
parent
5654997c00
commit
51cbf27b74
@ -62,6 +62,7 @@ void recinit(unsigned int n)
|
||||
|| (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
|
||||
|| (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
|
||||
FATAL("out of space for $0 and fields");
|
||||
*record = '\0';
|
||||
*fldtab[0] = dollar0;
|
||||
fldtab[0]->sval = record;
|
||||
fldtab[0]->nval = tostring("0");
|
||||
|
Loading…
Reference in New Issue
Block a user