[comp.sources.bugs] rn 4.3 patch #36

lwall@sdcrdcf.UUCP (Larry Wall) (11/17/86)

System: rn version 4.3
Patch #: 36
Priority: depends
Subject: Rn can dump core on 16 bit machines
From: mn-at1!alan (Alan Klietz)

Description:
	Rn dumps core on 16 bit machines when adding a new
	newsgroup to the .newsrc file.
	
Repeat by:
	Create a new newsgroup and then run rn.
	It will dump core.

Fix:
	The birthof() procedure fails to coerce the null pointer
	to the time() system call to (long *).  This results in
	a 16 bit quantity being pushed on the stack which is 
	derefernced by the time() system call as a 32 bit quantity.
	This results in a segment violation.

	The fix is to use a properly coerced pointer.

	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.

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	[Note, I cannot test this patch because rn is being rewritten--law]

	If you are missing previous patches they can be obtained from me:

	Larry Wall
	{allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall

	If you send a mail message of the following form it will greatly speed
	processing:

	Subject: Command
	@SH mailpatch PATH rn 4.3 LIST

	where PATH is a return path FROM ME TO YOU in bang notation, and LIST
	is a list of one or more patches you need, separated by spaces, commas
	and/or hyphens.

Index: patchlevel
Prereq: 35
1c1
< Patch #: 35
---
> Patch #: 36

Index: addng.c
*** addng.c.orig	Tue Nov 11 17:03:35 1986
--- addng.c	Tue Nov 11 17:08:28 1986
***************
*** 111,117
   
      sprintf(tst, ngsize ? "%s/%s/1" : "%s/%s" ,spool,getngdir(ngnam));
      if (stat(tst,&filestat) < 0)
! 	return (ngsize ? 0L : time(0));	/* not there, assume something good */
      else
  	return filestat.st_mtime;
  }

--- 111,118 -----
   
      sprintf(tst, ngsize ? "%s/%s/1" : "%s/%s" ,spool,getngdir(ngnam));
      if (stat(tst,&filestat) < 0)
! 	return (ngsize ? 0L : time(Null(long *)));
! 	/* not there, assume something good */
      else
  	return filestat.st_mtime;
  }