From roberte@ghost.mep.ruhr-uni-bochum.de  Mon Sep 22 14:32:54 1997
Received: from ghost.mep.ruhr-uni-bochum.de (ghost.mep.ruhr-uni-bochum.de [134.147.6.33])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA22207
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 Sep 1997 14:32:50 -0700 (PDT)
Received: (from roberte@localhost)
          by ghost.mep.ruhr-uni-bochum.de (8.8.5/8.8.4)
	  id XAA01547; Mon, 22 Sep 1997 23:32:50 +0200 (MESZ)
Message-Id: <199709222132.XAA01547@ghost.mep.ruhr-uni-bochum.de>
Date: Mon, 22 Sep 1997 23:32:50 +0200 (MESZ)
From: Robert Eckardt <roberte@MEP.Ruhr-Uni-Bochum.de>
Reply-To: roberte@MEP.Ruhr-Uni-Bochum.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: fmt dumps core on ^M (in 2.2.2 again)
X-Send-Pr-Version: 3.2

>Number:         4607
>Category:       bin
>Synopsis:       fmt dumps core on ^M (in 2.2.2 again)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 22 14:40:01 PDT 1997
>Closed-Date:    Mon Sep 29 22:54:21 MEST 1997
>Last-Modified:  Mon Sep 29 22:57:39 MEST 1997
>Originator:     Robert Eckardt
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
>Environment:

	FreeBSD-2.2.2 with tcsh under X

>Description:

	fmt experiences Bus error when one tries to format
	a text that starts with ^M (CR) (e.g. from an MSDOS
	system) or another non-printable character.

	This bug was already handled and removed for FreeBSD 2.2-BETA_A
	under `bin/2968'.

>How-To-Repeat:

	In the simplest case:
        1:05 ghost: /home/re 0% printf '\r'>fmttest
        1:05 ghost: /home/re 0% fmt fmttest
        Bus error (core dumped)

>Fix:
	
	Gareth McCaughan (gjm11@dpmms.cam.ac.uk) supplied the following
	patch for 2.2-BETA_A, which also works for 2.2.2:

*** fmt.c.orig  Mon Sep 22 23:28:42 1997
--- fmt.c       Mon Sep 22 23:25:01 1997
***************
*** 147,151 ****
        register int c, col;
  #define CHUNKSIZE 1024
!       static int lbufsize = 0, cbufsize = 0;
  
        if (center) {
--- 147,155 ----
        register int c, col;
  #define CHUNKSIZE 1024
!       static int lbufsize = 0, cbufsize = CHUNKSIZE;
! 
!       canonb = malloc(CHUNKSIZE);
!       if (canonb == 0)
!               abort();
  
        if (center) {


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Mon Sep 29 22:54:21 MEST 1997 
State-Changed-Why:  

Sorry, we can't fix 2.2.2 anymore. ;) The fix from bin/2968 has been 
applied after 2.2.2 shipped, but it's in HEAD as well as RELENG_2_2 
now. 
>Unformatted:
