1
0
mirror of https://github.com/robmcmullen/atrcopy.git synced 2025-03-04 20:30:20 +00:00

Added addl sanity checking for boot sector params in BootDiskImage

This commit is contained in:
Rob McMullen 2016-06-02 13:00:21 -07:00
parent 68de323d3f
commit 0b6b704667

@ -340,8 +340,10 @@ class BootDiskImage(DiskImageBase):
max_ram = 0xc000
max_size = max_ram - bload
max_sectors = max_size / self.header.sector_size
if nsec > max_sectors:
if nsec > max_sectors or nsec < 3:
raise InvalidDiskImage("Number of boot sectors out of range")
if bload < 0x200 or bload > (0xc000 - (nsec * self.header.sector_size)):
raise InvalidDiskImage("Bad boot load address")
def add_atr_header(bytes):
header = AtrHeader(create=True)