Subject: dump: old bugs polished up as new ones :-)
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
List: netbsd-bugs
Date: 01/14/1994 21:57:43
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"

Hi,

I think this bug has been reported before, but here we go again...  Without
this, dump gets a SIGSEVG indexing outside the array usedinomap in
traverse.c.

dump.h says:

#define SETINO(ino, map) \
        map[(u_int)((ino) - 1) / NBBY] |=  1 << ((u_int)((ino) - 1) % NBBY)

and a debugging session goes like this:

  DUMP: mapping (Pass I) [regular files]

Program received signal 11, Segmentation fault
Reading in symbols for /usr/src/sbin/dump/traverse.c...done.
0x6311 in mapfiles (maxino=0x000104ff, tapesize=(int *) 0x2b6d4) (/usr/src/sbin/dump/traverse.c line 123)
123                     SETINO(ino, usedinomap);
(gdb) p ino
$1 = 0x00000000
(gdb) p usedinomap
$2 = (char *) 0x35000 
(gdb) 

So there you go...

Here's the change I've applied, once again.  It stops dump from
core-dumping at least...


- Havard

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-Description: traverse.c patch

*** traverse.c.old	Wed Dec 22 11:24:59 1993
--- traverse.c	Fri Jan 14 21:49:04 1994
***************
*** 117,121 ****
  	int anydirskipped = 0;
  
! 	for (ino = 0; ino < maxino; ino++) {
  		dp = getino(ino);
  		if ((mode = (dp->di_mode & IFMT)) == 0)
--- 117,121 ----
  	int anydirskipped = 0;
  
! 	for (ino = 1; ino < maxino; ino++) {
  		dp = getino(ino);
  		if ((mode = (dp->di_mode & IFMT)) == 0)

------- =_aaaaaaaaaa0--

------------------------------------------------------------------------------