shithub: trueawk

Download patch

ref: 7580235939d2c4f300827b9444675f35341a00e0
parent: 2dc7e5ff1a4feeeb549f32706cf34e17aba89192
author: Cody Peter Mello <melloc@writev.io>
date: Mon Nov 12 05:34:19 EST 2018

Fix initial "fields" buffer size

--- a/lib.c
+++ b/lib.c
@@ -59,7 +59,7 @@
 {
 	if ( (record = (char *) malloc(n)) == NULL
 	  || (fields = (char *) malloc(n+1)) == NULL
-	  || (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
+	  || (fldtab = (Cell **) malloc((nfields+2) * sizeof(Cell *))) == NULL
 	  || (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
 		FATAL("out of space for $0 and fields");
 	*fldtab[0] = dollar0;
--