[OpenBIOS] [PATCH 1/6] bootinfo_load: recognize ASCII EOT as end of bootinfo

Cormac O'Brien i.am.cormac.obrien at gmail.com
Sat Jun 20 19:48:57 CEST 2015


Mac OS 9's CHRP boot info consists of the standard SGML document terminated by
an ASCII EOT, followed by a large binary blob which is relocated by the Forth
script. This patch allows the bootinfo loader to stop loading the script if it
detects an EOT, avoiding the out-of-memory error previously encountered when
booting OS 9.

Signed-off-by: Cormac O'Brien <i.am.cormac.obrien at gmail.com>
---
 libopenbios/bootinfo_load.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libopenbios/bootinfo_load.c b/libopenbios/bootinfo_load.c
index fa9e36b..4b6a52c 100644
--- a/libopenbios/bootinfo_load.c
+++ b/libopenbios/bootinfo_load.c
@@ -161,6 +161,16 @@ bootinfo_init_program(void)
 	feval("load-size");
 	size = POP();
 
+	/* Check for a delimiting ASCII EOT, as in Mac OS 9 */
+	current = 0;
+	while (current < size) {
+		if (base[current] == 0x04) {
+			size = current;
+			break;
+		}
+		current++;
+	}
+
 	bootscript = malloc(size);
 	if (bootscript == NULL) {
 		DPRINTF("Can't malloc %d bytes\n", size);
-- 
2.4.4




More information about the OpenBIOS mailing list