sim_imd: Resolve CID 1502448, 1502460.
This commit is contained in:
parent
f0760cc5cb
commit
3b06ed7ec9
1 changed files with 17 additions and 2 deletions
19
sim_imd.c
19
sim_imd.c
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2007-2020 Howard M. Harte. *
|
* Copyright (c) 2007-2022 Howard M. Harte. *
|
||||||
* https://github.com/hharte *
|
* https://github.com/hharte *
|
||||||
* *
|
* *
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining *
|
* Permission is hereby granted, free of charge, to any person obtaining *
|
||||||
|
@ -150,7 +150,10 @@ static t_stat diskParse(DISK_INFO *myDisk, uint32 isVerbose)
|
||||||
do {
|
do {
|
||||||
sim_debug(myDisk->debugmask, myDisk->device, "start of track %d at file offset %ld\n", myDisk->ntracks, ftell(myDisk->file));
|
sim_debug(myDisk->debugmask, myDisk->device, "start of track %d at file offset %ld\n", myDisk->ntracks, ftell(myDisk->file));
|
||||||
|
|
||||||
sim_fread(&imd, 1, 5, myDisk->file);
|
if (sim_fread(&imd, 1, 5, myDisk->file) != 5) {
|
||||||
|
return (SCPE_OPENERR);
|
||||||
|
}
|
||||||
|
|
||||||
if (feof(myDisk->file))
|
if (feof(myDisk->file))
|
||||||
break;
|
break;
|
||||||
sectorSize = 128 << (imd.sectsize & 0x1f);
|
sectorSize = 128 << (imd.sectsize & 0x1f);
|
||||||
|
@ -169,6 +172,18 @@ static t_stat diskParse(DISK_INFO *myDisk, uint32 isVerbose)
|
||||||
myDisk->nsides = imd.head + 1;
|
myDisk->nsides = imd.head + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (imd.head >= MAX_HEAD) {
|
||||||
|
sim_printf("SIM_IMD: Invalid head %d, a maximum of %d heads are supported.\n",
|
||||||
|
imd.head, MAX_HEAD);
|
||||||
|
return (SCPE_IERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imd.cyl >= MAX_CYL) {
|
||||||
|
sim_printf("SIM_IMD: Invalid cylinder %d, a maximum of %d cylinders are supported.\n",
|
||||||
|
imd.cyl, MAX_CYL);
|
||||||
|
return (SCPE_IERR);
|
||||||
|
}
|
||||||
|
|
||||||
myDisk->track[imd.cyl][imd.head].mode = imd.mode;
|
myDisk->track[imd.cyl][imd.head].mode = imd.mode;
|
||||||
myDisk->track[imd.cyl][imd.head].nsects = imd.nsects;
|
myDisk->track[imd.cyl][imd.head].nsects = imd.nsects;
|
||||||
myDisk->track[imd.cyl][imd.head].sectsize = sectorSize;
|
myDisk->track[imd.cyl][imd.head].sectsize = sectorSize;
|
||||||
|
|
Loading…
Add table
Reference in a new issue