mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-26 10:29:54 +03:00
config: Misc macro improvements
This commit is contained in:
parent
b5808884a3
commit
cd4431f227
@ -192,7 +192,8 @@ int init_config(size_t config_size) {
|
||||
|
||||
// Expand macros
|
||||
if (macros != NULL) {
|
||||
char *new_config = ext_mem_alloc(config_size * 4);
|
||||
size_t new_config_size = config_size * 4;
|
||||
char *new_config = ext_mem_alloc(new_config_size);
|
||||
|
||||
size_t i, in;
|
||||
for (i = 0, in = 0; i < config_size;) {
|
||||
@ -232,14 +233,24 @@ int init_config(size_t config_size) {
|
||||
}
|
||||
pmm_free(macro_name, 1024);
|
||||
for (j = 0; macro_value[j] != 0; j++, in++) {
|
||||
if (in >= new_config_size) {
|
||||
goto overflow;
|
||||
}
|
||||
new_config[in] = macro_value[j];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in >= new_config_size) {
|
||||
overflow:
|
||||
bad_config = true;
|
||||
panic(true, "config: Macro-induced buffer overflow");
|
||||
}
|
||||
new_config[in++] = config_addr[i++];
|
||||
}
|
||||
|
||||
pmm_free(config_addr, config_size);
|
||||
|
||||
config_addr = new_config;
|
||||
config_size = in;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
${STIVALE_KERNEL}=boot:///boot/test.elf
|
||||
${BACKGROUND_PATH}=boot:///boot/bg.bmp
|
||||
|
||||
DEFAULT_ENTRY=1
|
||||
TIMEOUT=3
|
||||
GRAPHICS=yes
|
||||
@ -5,7 +8,7 @@ VERBOSE=yes
|
||||
|
||||
THEME_BACKGROUND=50000000
|
||||
|
||||
BACKGROUND_PATH=boot:///boot/bg.bmp
|
||||
BACKGROUND_PATH=${BACKGROUND_PATH}
|
||||
BACKGROUND_STYLE=stretched
|
||||
BACKDROP_COLOUR=008080
|
||||
|
||||
@ -16,10 +19,10 @@ COMMENT=Test of the stivale2 boot protocol.
|
||||
# Let's use autodetection
|
||||
#PROTOCOL=stivale2
|
||||
RESOLUTION=800x600
|
||||
KERNEL_PATH=boot:///boot/test.elf
|
||||
KERNEL_PATH=${STIVALE_KERNEL}
|
||||
KERNEL_CMDLINE=Woah! Another example!
|
||||
|
||||
MODULE_PATH=boot:///boot/bg.bmp
|
||||
MODULE_PATH=${BACKGROUND_PATH}
|
||||
MODULE_STRING=yooooo
|
||||
|
||||
# Test that the module string provided to the kernel will be
|
||||
|
Loading…
Reference in New Issue
Block a user