g_label_ntfs_taste: Abort taste is recsize == 0

This will avoid a 0-byte read (in g_read_data()) leading to a panic, if
previously read data are erroneous.

Suggested by:	John-Mark Gurney <jmg@funkthat.com>
This commit is contained in:
Jean-Sébastien Pédron 2013-03-08 18:07:43 +00:00
parent 105421ff81
commit f5c1ef84f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248058

View File

@ -115,7 +115,7 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size)
mftrecsz = (char)bf->bf_mftrecsz;
recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz);
if (recsize % pp->sectorsize != 0)
if (recsize == 0 || recsize % pp->sectorsize != 0)
goto done;
voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps +