1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-25 16:13:17 +00:00

If dsgetlabel() returns a label with a size of zero in diskdumpconf(),

treat it as an invalid partition.

This fixes a bug where ``dumpon <device>'' will configure the dump
device at a random offset on the disk if <device> isn't a valid
partition.

Reviewed by: phk
This commit is contained in:
Brian Somers 2002-10-05 11:24:21 +00:00
parent 4b96f22259
commit 52ae0b7fb5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104507

View File

@ -221,6 +221,8 @@ diskdumpconf(u_int onoff, dev_t dev, struct disk *dp)
dp->d_slice->dss_slices[dkslice(dev)].ds_offset) * DEV_BSIZE;
di.mediasize =
(off_t)(dl->d_partitions[dkpart(dev)].p_size) * DEV_BSIZE;
if (di.mediasize == 0)
return (EINVAL);
return(set_dumper(&di));
}