1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

loader: ptable_open() check for ptable_cd9660read result is wrong

The ptable_*read() functions return NULL on read errors (and partition table
closed as an side effect). The ptable_open must check the return value and
act properly.

PR:		232483
Reported by:	lev
Reviewed by:	lev,cem
Differential Revision:	https://reviews.freebsd.org/D17890
This commit is contained in:
Toomas Soome 2018-11-07 21:36:52 +00:00
parent a25896ca12
commit a3fd276be0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340240

View File

@ -675,10 +675,12 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize,
table->type = PTABLE_NONE;
STAILQ_INIT(&table->entries);
if (ptable_iso9660read(table, dev, dread) != NULL) {
if (table->type == PTABLE_ISO9660)
goto out;
}
if (ptable_iso9660read(table, dev, dread) == NULL) {
/* Read error. */
table = NULL;
goto out;
} else if (table->type == PTABLE_ISO9660)
goto out;
#ifdef LOADER_VTOC8_SUPPORT
if (be16dec(buf + offsetof(struct vtoc8, magic)) == VTOC_MAGIC) {