Merge from NetBSD:

Fix a panic that occurred when trying to traverse a corrupt msdosfs
filesystem.  With this particular corruption, the code in pcbmap()
would compute an offset into an array that was way out of bounds,
so check the bounds before trying to access and return an error if
the offset would be out of bounds.

Submitted by:	Xin LI
This commit is contained in:
Tim J. Robbins 2004-09-08 10:57:09 +00:00
parent 7a3b8aefbf
commit d23af19a71

View File

@ -237,6 +237,11 @@ pcbmap(dep, findcn, bnp, cnp, sp)
bp_bn = bn;
}
prevcn = cn;
if (bo >= bsize) {
if (bp)
brelse(bp);
return (EIO);
}
if (FAT32(pmp))
cn = getulong(&bp->b_data[bo]);
else