Index: stand/libsa/ufs.c =================================================================== --- stand/libsa/ufs.c +++ stand/libsa/ufs.c @@ -879,6 +879,13 @@ if (error) return (error); dp = (struct direct *)buf; + /* + * Probable corrupt directory entry, bail out + * rather than spin forever and hope the user + * has other options. + */ + if (dp->d_reclen == 0) + return (0); fp->f_seekp += dp->d_reclen; if (dp->d_ino == (ino_t)0) goto again; Index: stand/libsa/ufsread.c =================================================================== --- stand/libsa/ufsread.c +++ stand/libsa/ufsread.c @@ -111,6 +111,13 @@ *ino = d.d_ino; return d.d_type; } + /* + * Probable corrupt directory entry, bail out + * rather than spin forever and hope the user + * has other options. + */ + if (d.d_reclen == 0) + return 0; s += d.d_reclen; } if (n != -1 && ls)