Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2001 09:30:03 -0700 (PDT)
From:      Gregory Neil Shapiro <gshapiro@FreeBSD.ORG>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/26619: m4 silently truncates long strings
Message-ID:  <200105091630.f49GU3s07584@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26619; it has been noted by GNATS.

From: Gregory Neil Shapiro <gshapiro@FreeBSD.ORG>
To: Kris Kennaway <kris@obsecurity.org>
Cc: gshapiro+FreeBSD-gnats@gshapiro.net,
	FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/26619: m4 silently truncates long strings
Date: Wed, 9 May 2001 09:20:10 -0700

 >> >Description:
 >> m4 will silently truncate long strings on some operations leaving the data
 >> corrupted.
 
 kris> Any luck at identifying where the problem lies, or a fix?
 
 I have a fix but since I am not an expert on the m4 internals (damn, should
 have taken compilers in college), I didn't want to blindly commit it.  This
 fixes the problem (to be honest, it's changes the problem from 512
 characters to 4096 characters).  However, I don't know if it introduces any
 side effects.  It may be possible that some of the code was depending on
 MAXSTR being 512 and changing it introduces a buffer overflow.
 
 Index: mdef.h
 ===================================================================
 RCS file: /src/FreeBSD/cvsrepo/src/usr.bin/m4/mdef.h,v
 retrieving revision 1.3
 diff -u -r1.3 mdef.h
 --- mdef.h	1995/05/30 06:31:35	1.3
 +++ mdef.h	2001/05/09 16:17:55
 @@ -96,7 +96,7 @@
  #define EOS             (char) 0
  #define MAXINP          10              /* maximum include files   */
  #define MAXOUT          10              /* maximum # of diversions */
 -#define MAXSTR          512             /* maximum size of string  */
 +#define MAXSTR          4096            /* maximum size of string  */
  #define BUFSIZE         4096            /* size of pushback buffer */
  #define STACKMAX        1024            /* size of call stack      */
  #define STRSPMAX        4096            /* size of string space    */

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105091630.f49GU3s07584>