[comp.bugs.4bsd] Fsck dumps core

zmact61@doc.ic.ac.uk (Diomidis Spinellis) (02/06/90)

Index:	etc/fsck/pass1.c 4.3BSD (including Tahoe)

Description:
	Fsck dumps core.  An integer variable, (j in function pass1)
	can exceed 2^31.  When j is used to index dp->di_db[] it gives
	a negative offset which results in an incorrect address.

Repeat-By:
	Some probably rare combination of disk configuration, paritioning 
	and disk inconsistencies.

Fix:
	Change "etc/fsck/pass1.c" by applying the following patch.  A 
	thorough general cleanup to remove type inconsistencies between 
	daddr_t, long and unsigned int is needed, but it looks like a lot 
	of work.

*** pass1.c.orig	Tue Feb  6 11:42:59 1990
--- pass1.c	Tue Feb  6 11:41:57 1990
***************
*** 25,31 ****
  
  pass1()
  {
! 	register int c, i, j;
  	register DINODE *dp;
  	struct zlncnt *zlnp;
  	int ndb, cgd;
--- 25,31 ----
  
  pass1()
  {
! 	register unsigned int c, i, j;
  	register DINODE *dp;
  	struct zlncnt *zlnp;
  	int ndb, cgd;

--
Diomidis Spinellis                  Internet:                 dds@cc.ic.ac.uk
Department of Computing             BITNET:                   dds@cc.ic.ac.uk
Imperial College                    UUCP:   ...!cernvax!cc.imperial.ac.uk!dds
London SW7 2BZ                      JANET:                    dds@uk.ac.ic.cc