From f5a7c612146bdb22c9c0ac4baed898faaaa5eea3 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Wed, 19 Nov 2025 13:07:20 -0800 Subject: [PATCH] Validate Boot Record Meta Data - Added basic checks to verify boot image size is > 0 before attempting to load. Thanks and credit to @hubertushirsch. See Discussion #631. Co-Authored-By: HubertH <51236138+hubertushirsch@users.noreply.github.com> --- Source/HBIOS/romldr.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/HBIOS/romldr.asm b/Source/HBIOS/romldr.asm index 4e9880c8..5fd3f908 100644 --- a/Source/HBIOS/romldr.asm +++ b/Source/HBIOS/romldr.asm @@ -1576,6 +1576,8 @@ diskboot9: ld de,(bb_cpmloc) ; de := start or a ; clear carry sbc hl,de ; hl := length to load + jp z,err_sig ; can't load zero length + jp c,err_sig ; can't load negative length ; If load length is not a multiple of sector size (512) ; we need to round up to get everything loaded! ld de,511 ; 1 less than sector size @@ -2668,7 +2670,7 @@ str_err_noslice .db "Disk unit does not support slices",0 str_err_badslice .db "Slice specified is illegal",0 str_err_nocon .db "Invalid character unit specification",0 str_err_diskio .db "Disk I/O failure",0 -str_err_sig .db "No system image on disk",0 +str_err_sig .db "Invalid boot record",0 str_err_api .db "Unexpected hardware BIOS API failure",0 ; ;=======================================================================