[net.sources.bugs] Rn bug patch #7

jonab@sdcrdcf.UUCP (Jonathan Biggar) (11/17/84)

System:	rn version 4.1
Bug #: 7
Priority: MEDIUM
Subject: core dump on portable rn
Index: intrp.c
Prereq: 4.1.1.2
From: mcneal@forace.UUCP (Rick McNeal), north@down.UUCP (Stephen C North)

Description:
	With PHOSTNAME defined Rn will core dump when determining
	the site name.

Repeat-By:
	Rn popens PHOSTNAME and the variable pipefp is then pointing to
	a stream.  Instead of Rn using pipefp in the fgets() call
	it uses a temporary variable(tmpfp) that has yet to be defined.
	The temporary is declared of course in common.h which is why 
	the compiler never complains.

Fix:	This patch must be applied only to revision 4.1.1.2 of
	intrp.c (with patch #1 installed, including comments).

	From rn, say "| patch -d DIR", where DIR is your rn source directory.
	Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
	the patch program, apply the following by hand, or get patch.

*** /tmp/,RCSt1014724	Fri Oct 12 15:11:58 1984
--- /tmp/,RCSt2014724	Fri Oct 12 15:12:12 1984
***************
*** 1,4
! /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall

--- 1,4 -----
! /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
***************
*** 1,6
  /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall
   * %i used ARTID_LINE, should be MESSID_LINE.
   * 

--- 1,9 -----
  /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
+  * Revision 4.1.1.3  84/10/12  14:32:40  lwall
+  * Fixed PHOSTNAME core dump.
+  * 
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall
   * %i used ARTID_LINE, should be MESSID_LINE.
   * 
***************
*** 137,143
  	FILE *popen();
  	FILE *pipefp = popen(PHOSTNAME,"r");
  
! 	fgets(buf,sizeof buf,tmpfp);
  	buf[strlen(buf)-1] = '\0';	/* wipe out newline */
  	hostname = savestr(buf);
  	pclose(pipefp);

--- 140,146 -----
  	FILE *popen();
  	FILE *pipefp = popen(PHOSTNAME,"r");
  
! 	fgets(buf,sizeof buf,pipefp);
  	buf[strlen(buf)-1] = '\0';	/* wipe out newline */
  	hostname = savestr(buf);
  	pclose(pipefp);