bin/100443 : awk(1) dies with SIGBUS when processing INDEX-6

Devon H. O'Dell devon.odell at
Thu Sep 14 14:40:30 PDT 2006

The following reply was made to PR bin/100443; it has been noted by GNATS.

From: "Devon H. O'Dell" <devon.odell at>
To: Dmitry Marakasov <amdmi3 at>,  bug-followup at
Subject: Re: bin/100443 : awk(1) dies with SIGBUS when processing INDEX-6
Date: Thu, 14 Sep 2006 17:31:27 -0400

 This is a multi-part message in MIME format.
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 Got it. It was an off-by-one in fldbld(). Using the attached patch, I 
 now get:
  > ./
 The patch is attached, seems to not modify other awk behavior (or crash 
 when the buffer becomes 8193 bytes, which it didn't anyway), and is also 
 available at
 Do we need to send this upstream?
 Content-Type: text/plain;
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
 Index: contrib/one-true-awk/lib.c
 RCS file: /home/ncvs/src/contrib/one-true-awk/lib.c,v
 retrieving revision
 diff -u -r1.1.1.4 lib.c
 --- contrib/one-true-awk/lib.c	16 May 2005 19:11:33 -0000
 +++ contrib/one-true-awk/lib.c	14 Sep 2006 21:27:10 -0000
 @@ -266,7 +266,7 @@
  	r = fldtab[0]->sval;
  	n = strlen(r);
 -	if (n > fieldssize) {
 +	if (n >= fieldssize) {
  		if ((fields = (char *) malloc(n+1)) == NULL)
  			FATAL("out of space for fields in fldbld %d", n);

More information about the freebsd-bugs mailing list