Don't crash when utilities are dumb and try to read less than the disk block
size (dumpfs may try to read the cylinder size (or is is sector size?) by way of bread). Prevents a bounds error.
This commit is contained in:
parent
a778dc9ca5
commit
e3e8d2ca45
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109511
@ -63,7 +63,7 @@ bread(struct uufsd *disk, ufs2_daddr_t blockno, void *data, size_t size)
|
||||
*/
|
||||
if (cnt != size) {
|
||||
ERROR(disk, "short read from block device");
|
||||
for (cnt = 0; cnt < disk->d_fs.fs_bsize; cnt++)
|
||||
for (cnt = 0; cnt < MIN(size, disk->d_fs.fs_bsize); cnt++)
|
||||
buf[cnt] = 0;
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user