loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR:		236585
Submitted by:	john@feith.com
Reported by:	john@feith.com
MFC after:	1 day
This commit is contained in:
Toomas Soome 2019-05-05 06:38:47 +00:00
parent b4967c9b6f
commit 15f5e297d0

View File

@ -221,6 +221,10 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize)
struct ptable_entry part;
int rc, slice, partition;
if (sectorsize == 0) {
DPRINTF("unknown sector size");
return (ENXIO);
}
rc = 0;
od = (struct open_disk *)malloc(sizeof(struct open_disk));
if (od == NULL) {