mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-29 22:10:27 +00:00
Make shell script magic less prone to breakage (#643)
The metal boot sector code was wrapped in a single-quoted string, like so: MZqFpD=' ...MZ HEADER... ...E_LFANEW... ...BIOS BOOT SECTOR...' This might break the shell code loader if the boot sector code contains a 0x27 (single quote) byte. This patch wraps the boot sector code in a here-document instead: MZqFpD=' ...MZ HEADER...' <<'@' ...E_LFANEW... ...BIOS BOOT SECTOR... @ This is harder to break — when interpreted as a shell script, the code can only accidentally terminate the here-document if there is a "\n@\n" sequence inside the BIOS boot portion.
This commit is contained in:
parent
5005f2e446
commit
3e0ddf70e9
2 changed files with 3 additions and 7 deletions
|
@ -565,10 +565,7 @@ SHSTUB2(ape_loader_dd_count,
|
|||
#if SupportsMetal()
|
||||
HIDDEN(v_ape_realsectors =
|
||||
MIN(0x70000 - IMAGE_BASE_REAL,
|
||||
ROUNDUP(RVA(_edata), 4096)) / 512);
|
||||
HIDDEN(v_ape_realslacksectors =
|
||||
v_ape_realsectors - MIN(0x70000 - IMAGE_BASE_REAL,
|
||||
ROUNDUP(RVA(_edata), 512)) / 512);
|
||||
ROUNDUP(RVA(_edata), 512)) / 512);
|
||||
HIDDEN(v_ape_realpages = v_ape_realsectors / (4096 / 512));
|
||||
HIDDEN(v_ape_highsectors =
|
||||
(ROUNDUP(RVA(_edata), 512) / 512) - v_ape_realsectors);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue