limine: Fix internal module path corruption from static URI buffer

This commit is contained in:
Mintsuki 2026-01-13 05:54:11 +01:00
parent 9659672e09
commit 89df8597a1
No known key found for this signature in database
GPG Key ID: 1F3C021BECA23821

View File

@ -443,6 +443,10 @@ noreturn void limine_load(char *config, char *cmdline) {
strcpy(k_path_copy, kernel_path);
char *k_resource = NULL, *k_root = NULL, *k_path = NULL, *k_hash = NULL;
uri_resolve(k_path_copy, &k_resource, &k_root, &k_path, &k_hash);
// Copy k_resource and k_root since uri_resolve returns pointers to a static
// buffer that gets overwritten by subsequent uri_open/uri_resolve calls
k_resource = strdup(k_resource);
k_root = strdup(k_root);
char *k_path_ = ext_mem_alloc(strlen(k_path) + 2);
k_path_[0] = '/';
strcpy(k_path_ + 1, k_path);