diff options
author | ru <ru@FreeBSD.org> | 2006-09-15 13:33:32 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2006-09-15 13:33:32 +0000 |
commit | e62cd4548c9deedf2bc3c473ee33bde8f80015db (patch) | |
tree | 86fe843be0cf985186804740136342062512cd02 /usr.bin/awk | |
parent | a2c9c25cbe205645c39fb632c04a128ad6e2a2fe (diff) | |
download | FreeBSD-src-e62cd4548c9deedf2bc3c473ee33bde8f80015db.zip FreeBSD-src-e62cd4548c9deedf2bc3c473ee33bde8f80015db.tar.gz |
Initial memory allocation for fields was off-by-one.
PR: bin/100443
MFC after: 3 days
Diffstat (limited to 'usr.bin/awk')
-rw-r--r-- | usr.bin/awk/Makefile | 2 | ||||
-rw-r--r-- | usr.bin/awk/lib.c.diff | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile index 87eaa41..7ca3c73 100644 --- a/usr.bin/awk/Makefile +++ b/usr.bin/awk/Makefile @@ -29,7 +29,7 @@ CLEANFILES+= nawk.1 nawk.1: awk.1 cat ${.ALLSRC} > ${.TARGET} -.for f in b.c main.c run.c +.for f in b.c lib.c main.c run.c ${f}: ${AWKSRC}/${f} ${.CURDIR}/${f}.diff patch -s -b .orig -o ${.TARGET} < ${.CURDIR}/${f}.diff ${AWKSRC}/${f} CLEANFILES+= ${f} diff --git a/usr.bin/awk/lib.c.diff b/usr.bin/awk/lib.c.diff new file mode 100644 index 0000000..040485a --- /dev/null +++ b/usr.bin/awk/lib.c.diff @@ -0,0 +1,18 @@ +$FreeBSD$ + +Index: lib.c +=================================================================== +RCS file: /home/ncvs/src/contrib/one-true-awk/lib.c,v +retrieving revision 1.1.1.4 +diff -u -p -r1.1.1.4 lib.c +--- lib.c 16 May 2005 19:11:33 -0000 1.1.1.4 ++++ lib.c 15 Sep 2006 10:10:59 -0000 +@@ -58,7 +58,7 @@ static Cell dollar1 = { OCELL, CFLD, NUL + void recinit(unsigned int n) + { + if ( (record = (char *) malloc(n)) == NULL +- || (fields = (char *) malloc(n)) == NULL ++ || (fields = (char *) malloc(n+1)) == NULL + || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL + || (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL ) + FATAL("out of space for $0 and fields"); |