Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2001 11:57:11 -0700 (PDT)
From:      gshapiro+FreeBSD-gnats@gshapiro.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/26619: m4 silently truncates long strings
Message-ID:  <200104161857.f3GIvBDF035576@horsey.gshapiro.net>

next in thread | raw e-mail | index | archive | help

>Number:         26619
>Category:       bin
>Synopsis:       m4 silently truncates long lines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 16 12:00:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Gregory Neil Shapiro
>Release:        FreeBSD 4.3-RC i386
>Organization:
>Environment:
System: FreeBSD horsey.gshapiro.net 4.3-RC FreeBSD 4.3-RC #15: Sat Apr 14 12:21:56 PDT 2001 gshapiro@horsey.gshapiro.net:/home/FreeBSD/RELENG_4/obj/sys/HORSEY i386
>Description:
m4 will silently truncate long strings on some operations leaving the data
corrupted.
>How-To-Repeat:

The m4 file below demonstrates the problem.  Note that after running it with:

m4 test.m4

The output shows SameList has been truncated without an error from m4.

Here is test.m4:

define(`LongList', ` assert.c debug.c exc.c heap.c match.c rpool.c strdup.c strerror.c strl.c clrerr.c fclose.c feof.c ferror.c fflush.c fget.c fpos.c findfp.c flags.c fopen.c fprintf.c fpurge.c fput.c fread.c fscanf.c fseek.c fvwrite.c fwalk.c fwrite.c get.c makebuf.c put.c refill.c rewind.c rget.c setvbuf.c smstdio.c snprintf.c sscanf.c stdio.c strio.c syslogio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vsnprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c stringf.c xtrap.c strto.c test.c path.c strcasecmp.c signal.c clock.c config.c shm.c ')dnl
define(`SameList', `substr(LongList, 0, index(LongList, `.'))`'substr(LongList, index(LongList, `.'))')dnl
Long`'List is: LongList

Same`'List is: SameList

ifelse(len(LongList), len(SameList), `',
`errprint(`This version of m4 is broken: length problem')')dnl

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:

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?200104161857.f3GIvBDF035576>