[14879] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: sgi 8.0I: from -r garbles subject lines

daemon@ATHENA.MIT.EDU (Bruce R. Lewis)
Thu Dec 12 10:22:45 1996

Date: Thu, 12 Dec 1996 15:22:41 GMT
From: "Bruce R. Lewis" <brlewis@MIT.EDU>
To: Craig Fields <cfields@MIT.EDU>
Cc: bugs@MIT.EDU, source-reviewers@MIT.EDU
In-Reply-To: "[63] in Source-Reviewers"

Yes, let's get this little bug behind us.

Here's a patch that makes the two parts consistent and adds the \n to
the error message.

Index: athena/bin/from/from.c
===================================================================
RCS file: /afs/dev/source/repository/athena/bin/from/from.c,v
retrieving revision 1.17
diff -c -r1.17 from.c
*** from.c	1996/09/19 22:37:01	1.17
--- from.c	1996/12/12 15:18:24
***************
*** 556,569 ****
      }
    }
  
!   buf = malloc(winlength+1);  /* add 1 for the NULL terminator */
    if (buf == NULL)
      {
!       fprintf (stderr, "from: out of memory");
        exit (1);
      }    
!   buf[0] = '\0';
!   buf[winlength] = '\0';
    if (from_field)
      strncpy(buf, from_field, winlength);
    else
--- 556,568 ----
      }
    }
  
!   buf = calloc(winlength+1);  /* add 1 for the NULL terminator */
    if (buf == NULL)
      {
!       fprintf (stderr, "from: out of memory\n");
        exit (1);
      }    
! 
    if (from_field)
      strncpy(buf, from_field, winlength);
    else
***************
*** 572,584 ****
    if  (len < 30)
      len = 30;
  
!   buf1 = malloc(winlength-len+1);  /* add 1 for the NULL terminator */
    if (buf1 == NULL)
      {
!       fprintf (stderr, "from: out of memory");
        exit (1);
      }    
-   buf1[0] = '\0';
  
    if (winlength - len - 1 < 1)
      subject_field = NULL;
--- 571,582 ----
    if  (len < 30)
      len = 30;
  
!   buf1 = calloc(winlength-len+1);  /* add 1 for the NULL terminator */
    if (buf1 == NULL)
      {
!       fprintf (stderr, "from: out of memory\n");
        exit (1);
      }    
  
    if (winlength - len - 1 < 1)
      subject_field = NULL;

home help back first fref pref prev next nref lref last post