Fix bug in expanding lost+found direct blocks.

Reported by:  Peter Holm
Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2021-01-06 16:31:33 -08:00
parent f2b794e1e9
commit c8a7a3ffe1

View File

@ -657,7 +657,7 @@ expanddir(union dinode *dp, char *name)
* If last block is a fragment, expand it to a full size block.
*/
lastlbnsize = sblksize(&sblock, filesize, lastlbn);
if (lastlbnsize < sblock.fs_bsize) {
if (lastlbnsize > 0 && lastlbnsize < sblock.fs_bsize) {
oldblk = DIP(dp, di_db[lastlbn]);
bp = getdirblk(oldblk, lastlbnsize);
if (bp->b_errs)