menu: Fix issue where command line buffer was allocated in conventional memory and subsequently discarded
This commit is contained in:
parent
9b7f9e4209
commit
4c09663a28
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -37,9 +37,6 @@ static void cursor_fwd(void) {
|
|||||||
set_cursor_pos(x, y);
|
set_cursor_pos(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *cmdline;
|
|
||||||
#define CMDLINE_MAX 1024
|
|
||||||
|
|
||||||
#define EDITOR_MAX_BUFFER_SIZE 4096
|
#define EDITOR_MAX_BUFFER_SIZE 4096
|
||||||
|
|
||||||
static size_t get_line_offset(size_t *displacement, size_t index, const char *buffer) {
|
static size_t get_line_offset(size_t *displacement, size_t index, const char *buffer) {
|
||||||
@ -241,9 +238,7 @@ static int print_tree(int level, int base_index, int selected_entry,
|
|||||||
return max_entries;
|
return max_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *menu(char **cmdline_ret) {
|
char *menu(char **cmdline) {
|
||||||
cmdline = conv_mem_alloc(CMDLINE_MAX);
|
|
||||||
|
|
||||||
struct menu_entry *selected_menu_entry;
|
struct menu_entry *selected_menu_entry;
|
||||||
|
|
||||||
int selected_entry = 0;
|
int selected_entry = 0;
|
||||||
@ -380,15 +375,14 @@ timeout_aborted:
|
|||||||
goto refresh;
|
goto refresh;
|
||||||
}
|
}
|
||||||
enable_cursor();
|
enable_cursor();
|
||||||
cmdline = config_get_value(selected_menu_entry->body, 0, "KERNEL_CMDLINE");
|
*cmdline = config_get_value(selected_menu_entry->body, 0, "KERNEL_CMDLINE");
|
||||||
if (!cmdline) {
|
if (!*cmdline) {
|
||||||
cmdline = config_get_value(selected_menu_entry->body, 0, "CMDLINE");
|
*cmdline = config_get_value(selected_menu_entry->body, 0, "CMDLINE");
|
||||||
}
|
}
|
||||||
if (!cmdline) {
|
if (!*cmdline) {
|
||||||
cmdline[0] = '\0';
|
*cmdline = "";
|
||||||
}
|
}
|
||||||
clear(true);
|
clear(true);
|
||||||
*cmdline_ret = cmdline;
|
|
||||||
term_double_buffer(false);
|
term_double_buffer(false);
|
||||||
return selected_menu_entry->body;
|
return selected_menu_entry->body;
|
||||||
case 'e': {
|
case 'e': {
|
||||||
|
Loading…
Reference in New Issue
Block a user