[comp.bugs.4bsd] repl in MH-6.4

sow@luthcad.UUCP (04/02/87)

Index: .../mh/uip/replsbr.c

Description:
	The repl(1) command, part of MH-6.4, dumps core on a computer
	which did not accepts nil pointers e.g. Sun. If we don't want
	the field and it is a long field so we get the state FLDPLUS.


Repeat-By:
	Use repl(1) on a Sun with a very long To list in the
	message you reply to.


Fix:
	Check if the pointer is NIL before adding any information
	to it.



*** uip/replsbr.c.old	Thu Apr  2 16:48:09 1987
--- uip/replsbr.c	Thu Apr  2 16:49:34 1987
***************
*** 142,148
  			}
  		    } while (cptr = cptr->c_next);
  
! 		while (state == FLDPLUS) {
  		    state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
  		    cptr->c_text = add (tmpbuf, cptr->c_text);
  		    char_read += msg_count;

--- 142,148 -----
  			}
  		    } while (cptr = cptr->c_next);
  
! 		while (state == FLDPLUS && cptr != NULL) {
  		    state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
  		    cptr->c_text = add (tmpbuf, cptr->c_text);
  		    char_read += msg_count;


Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea
Tel:     +46-920-91677  (work)         +46-920-48390  (home)
UUCP:    sow@luthcad.UUCP  or  seismo!mcvax!enea!luthcad!sow
ARPA:    enea!luthcad!sow@seismo.css.gov

sow@luthcad.UUCP (04/02/87)

Index: .../mh/uip/replsbr.c

Description:
	The repl(1) command, part of MH-6.4, dumps core on a computer
	which did not accepts nil pointers e.g. Sun. If we don't want
	the field and it is a long field so we get the state FLDPLUS.


Repeat-By:
	Use repl(1) on a Sun with a very long To list in the
	message you reply to.


Fix:
	Don't get the rest of the field if we don't want the field.



*** uip/replsbr.c.old	Thu Apr  2 16:48:09 1987
--- uip/replsbr.c	Thu Apr  2 18:51:15 1987
***************
*** 119,125
  		 * buffer as the component temp buffer (buffer switching
  		 * saves an extra copy of the component text).
  		 */
! 		if (cptr = wantcomp[CHASH(name)])
  		    do {
  			if (uleq(name, cptr->c_name)) {
  			    char_read += msg_count;

--- 119,125 -----
  		 * buffer as the component temp buffer (buffer switching
  		 * saves an extra copy of the component text).
  		 */
! 		if (cptr = wantcomp[CHASH(name)]) {
  		    do {
  			if (uleq(name, cptr->c_name)) {
  			    char_read += msg_count;
***************
*** 146,151
  		    state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
  		    cptr->c_text = add (tmpbuf, cptr->c_text);
  		    char_read += msg_count;
  		}
  		break;
  

--- 146,152 -----
  		    state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
  		    cptr->c_text = add (tmpbuf, cptr->c_text);
  		    char_read += msg_count;
+ 		}
  		}
  		break;

  
Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea
Tel:     +46-920-91677  (work)         +46-920-48390  (home)
UUCP:    sow@luthcad.UUCP  or  seismo!mcvax!enea!luthcad!sow
ARPA:    enea!luthcad!sow@seismo.css.gov