[14876] 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)
Wed Dec 11 09:19:30 1996

Date: Wed, 11 Dec 1996 14:19:28 GMT
From: "Bruce R. Lewis" <brlewis@MIT.EDU>
To: Mark Eichin <eichin@MIT.EDU>
Cc: bugs@MIT.EDU, source-reviewers@MIT.EDU
In-Reply-To: "[60] in Source-Reviewers"

The buf1[0] = '\0' is helpful iff you're not putting anything in buf1.
If you're copying the subject field into it, it would be
buf1[MAX(strlen(subject_field), winlength-len)] = '\0';

Greg is right that calloc would be simpler.

I don't have write access to the repository.  Can someone apply this
one?

  cvs -u diff -kk -c athena/bin/from/from.c > /tmp/patch3
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/11 14:14:53
***************
*** 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;
--- 572,583 ----
    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