mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
awk: fix out of bounds write with large fields (thanks kristo)
; dd < /dev/zero -bs 4 -count 8k | tr '\x0' A | awk '{a=$1}' Solution copied from onetrueawk.
This commit is contained in:
parent
26c21f9b5d
commit
207cd2812f
1 changed files with 1 additions and 1 deletions
|
@ -261,7 +261,7 @@ void fldbld(void) /* create fields from current record */
|
|||
n = strlen(r);
|
||||
if (n > fieldssize) {
|
||||
xfree(fields);
|
||||
if ((fields = (char *) malloc(n+1)) == nil)
|
||||
if ((fields = (char *) malloc(n+2)) == nil) /* possibly 2 final \0s */
|
||||
FATAL("out of space for fields in fldbld %d", n);
|
||||
fieldssize = n;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue