diff options
author | jmallett <jmallett@FreeBSD.org> | 2003-01-19 01:39:53 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2003-01-19 01:39:53 +0000 |
commit | 70c14dc49d43fdb49ece8fbd8376b5ad630a84ad (patch) | |
tree | 6ae20a9446a1a29fbfa6a350e09eceaf5f224cb1 | |
parent | 7a4607b5ca601c2df68d7e4186f3eb03cad1bf93 (diff) | |
download | FreeBSD-src-70c14dc49d43fdb49ece8fbd8376b5ad630a84ad.zip FreeBSD-src-70c14dc49d43fdb49ece8fbd8376b5ad630a84ad.tar.gz |
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.
-rw-r--r-- | lib/libufs/block.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libufs/block.c b/lib/libufs/block.c index 7586c43..234991a 100644 --- a/lib/libufs/block.c +++ b/lib/libufs/block.c @@ -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; } |