Subject: [resend] Pine 3.94 bounce crash--interim patch

From: Out of his mind <[email-masked]>
Date: Fri, 12 Jul 1996 08:44:45 -0400 (EDT)

[The original message had the attachment left out.  This post is correct.]

Attached to this message is a patch to pine3.94/pine/send.c created by the
Pine development team.  I've received numerous messages about the crash
caused by bouncing messages and am posting the patch myself until Pine 3.95
is released.

To apply the patch, extract the attached file to 'send.patch', cd to the
pine3.94/pine/ subdirectory of the distribution, and type:
    patch <../whatever/directory/send.patch

Make sure you use GNU patch or a fairly new BSD or SVR4 based patch program.
(Most recent OS releases will accept the patch.)

=====
== Todd Vierling (Personal [email-masked]; Business [email-masked]) Amiga lives! ==
== System administrator/technician, Internet Access Group, Orlando Florida ==
== Dialups in Orange, Volusia, Lake, Osceola counties - http://www.iag.net ==

*** 4.402	1996/06/07 18:26:14
--- send.c	1996/07/08 18:10:50
***************
*** 1,5 ****
  #if !defined(lint) && !defined(DOS)
! static char rcsid[] = "$Id: send.c,v 4.402 1996/06/07 18:26:14 hubert Exp $";
  #endif
  /*----------------------------------------------------------------------
  
--- 1,5 ----
  #if !defined(lint) && !defined(DOS)
! static char rcsid[] = "$Id: send.c,v 4.409 1996/07/08 18:10:18 mikes Exp $";
  #endif
  /*----------------------------------------------------------------------
  
***************
*** 4163,4172 ****
  		for(a = *pf->addr; a != NULL; a = a->next)
  		  if(a->error != NULL){
  		      if(addr_error_count++ < MAX_ADDR_ERROR){
! 			  if(last_he)		/* start last reported err */
! 			    last_he->start_here = 0;
  
! 			  (last_he = pf->he)->start_here = 1;
  			  if(error_mess)	/* previous error? */
  			    q_status_message(SM_ORDER, 4, 7, error_mess);
  
--- 4163,4175 ----
  		for(a = *pf->addr; a != NULL; a = a->next)
  		  if(a->error != NULL){
  		      if(addr_error_count++ < MAX_ADDR_ERROR){
! 			  if(pf->he){
! 			      if(last_he)	/* start last reported err */
! 				last_he->start_here = 0;
  
! 			      (last_he = pf->he)->start_here = 1;
! 			  }
! 
  			  if(error_mess)	/* previous error? */
  			    q_status_message(SM_ORDER, 4, 7, error_mess);
  
***************
*** 4183,4188 ****
--- 4186,4195 ----
  	      error_mess = error_buf;
  	}
  
+ 	/* repair modified "body_encodings" array? */
+ 	if(bp && sending_stream->ok_8bitmime)
+ 	  body_encodings[bp->encoding] = NULL;
+ 
  	TIME_STAMP("smtp closing", 1);
  	smtp_close(sending_stream);
  	sending_stream = NULL;
***************
*** 4215,4223 ****
      if(fake_env)
        mail_free_envelope(&fake_env);
  
-     if(bp)
-       body_encodings[bp->encoding] = NULL;
- 
    done:
      if(we_cancel)
        cancel_busy_alarm(0);
--- 4222,4227 ----
***************
*** 5944,5949 ****
--- 5948,5959 ----
  /*
   * def to make our pipe write's more friendly
   */
+ #ifdef	PIPE_MAX
+ #if	PIPE_MAX > 20000
+ #undef	PIPE_MAX
+ #endif
+ #endif
+ 
  #ifndef	PIPE_MAX
  #define	PIPE_MAX	1024
  #endif
***************
*** 6301,6306 ****
--- 6311,6317 ----
      char *error_mess, error_buf[100];
      int	  rv, we_cancel = 0;
      void *orig_822_output;
+     BODY *bp = NULL;
  
      we_cancel = busy_alarm(1, "Posting news", NULL, 1);
  
***************
*** 6330,6337 ****
  	     * Fake that we've got clearance from the transport agent
  	     * for 8bit transport for the benefit of our output routines...
  	     */
! 	    if(F_ON(F_ENABLE_8BIT_NNTP, ps_global))
! 	      sending_stream->ok_8bitmime = 1;
  
  	    /*
  	     * Set global header pointer so we can get at it later...
--- 6341,6361 ----
  	     * Fake that we've got clearance from the transport agent
  	     * for 8bit transport for the benefit of our output routines...
  	     */
! 	    if(F_ON(F_ENABLE_8BIT_NNTP, ps_global)
! 	       && (bp = first_text_8bit(body))){
! 		int i;
! 
! 		for(i = 0; (i <= ENCMAX) && body_encodings[i]; i++)
! 		  ;
! 
! 		if(i > ENCMAX){		/* no empty encoding slots! */
! 		    bp = NULL;
! 		}
! 		else {
! 		    body_encodings[i] = body_encodings[ENC8BIT];
! 		    bp->encoding = (unsigned short) i;
! 		}
! 	    }
  
  	    /*
  	     * Set global header pointer so we can get at it later...
***************
*** 6344,6349 ****
--- 6368,6375 ----
  
              smtp_close(sending_stream);
  	    sending_stream = NULL;
+ 	    if(F_ON(F_ENABLE_8BIT_NNTP, ps_global) && bp)
+ 	      body_encodings[bp->encoding] = NULL;
  
          } else {
              /*---- Open of NNTP connection failed ------ */