blkid_parttable tab, struct atari_part_def *part)
{
uint32_t x0start, xstart;
- unsigned i = 0;
+ unsigned ct = 0, i = 0;
int rc;
x0start = xstart = be32_to_cpu(part->start);
while (1) {
struct atari_rootsector *xrs;
+
+ if (++ct > 100)
+ break;
+
xrs = (struct atari_rootsector *) blkid_probe_get_sector(pr, xstart);
if (!xrs) {
if (errno)
blkid_partlist ls;
uint16_t block_size;
uint16_t ssf; /* sector size fragment */
- uint32_t nblks, i;
+ uint32_t nblks, nprts, i;
/* The driver descriptor record is always located at physical block 0,
ssf = block_size / 512;
nblks = be32_to_cpu(p->map_count);
-
- for (i = 0; i < nblks; ++i) {
+ if (nblks > 256) {
+ nprts = 256;
+ DBG(LOWPROBE, ul_debug(
+ "mac: map_count too large, entry[0]: %u, "
+ "enforcing limit of %u", nblks, nprts));
+ } else
+ nprts = nblks;
+
+ for (i = 0; i < nprts; ++i) {
blkid_partition par;
uint32_t start;
uint32_t size;
if (be32_to_cpu(p->map_count) != nblks) {
DBG(LOWPROBE, ul_debug(
"mac: inconsistent map_count in partition map, "
- "entry[0]: %d, entry[%d]: %d",
+ "entry[0]: %u, entry[%u]: %u",
nblks, i,
be32_to_cpu(p->map_count)));
}