* Do not try to recreate the path of a preloaded module if a full path has been
passed in by the boot loader. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27686 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1085,25 +1085,32 @@ register_preloaded_module_image(struct preloaded_image* image)
|
|||||||
|
|
||||||
image->is_module = true;
|
image->is_module = true;
|
||||||
|
|
||||||
|
if (moduleImage->info[0] == NULL) {
|
||||||
|
status = B_BAD_DATA;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
moduleImage->dependencies = NULL;
|
moduleImage->dependencies = NULL;
|
||||||
get_image_symbol(image->id, "module_dependencies", B_SYMBOL_TYPE_DATA,
|
get_image_symbol(image->id, "module_dependencies", B_SYMBOL_TYPE_DATA,
|
||||||
(void**)&moduleImage->dependencies);
|
(void**)&moduleImage->dependencies);
|
||||||
// this is allowed to be NULL
|
// this is allowed to be NULL
|
||||||
|
|
||||||
// Try to recreate the full module path, so that we don't try to load the
|
if (image->name[0] != '/') {
|
||||||
// image again when asked for a module it does not export (would only be
|
// Try to recreate the full module path, so that we don't try to load
|
||||||
// problematic if it had got replaced and the new file actually exports
|
// the image again when asked for a module it does not export (would
|
||||||
// that module). Also helpful for recurse_directory().
|
// only be problematic if it had got replaced and the new file actually
|
||||||
{
|
// exports that module). Also helpful for recurse_directory().
|
||||||
// ToDo: this is kind of a hack to have the full path in the hash
|
|
||||||
|
// TODO: check if there is a situation (like floppy/network boot) where
|
||||||
|
// relative paths are still passed in.
|
||||||
|
// TODO: this is kind of a hack to have the full path in the hash
|
||||||
// (it always assumes the preloaded add-ons to be in the system
|
// (it always assumes the preloaded add-ons to be in the system
|
||||||
// directory)
|
// directory)
|
||||||
|
const char* name = moduleImage->info[0]->name;
|
||||||
|
const char* suffix = strstr(name, image->name);
|
||||||
|
if (suffix != NULL) {
|
||||||
char path[B_FILE_NAME_LENGTH];
|
char path[B_FILE_NAME_LENGTH];
|
||||||
const char* suffix;
|
|
||||||
const char* name;
|
|
||||||
if (moduleImage->info[0]
|
|
||||||
&& (suffix = strstr(name = moduleImage->info[0]->name,
|
|
||||||
image->name)) != NULL) {
|
|
||||||
// even if strlcpy() is used here, it's by no means safe
|
// even if strlcpy() is used here, it's by no means safe
|
||||||
// against buffer overflows
|
// against buffer overflows
|
||||||
KPath addonsKernelPath;
|
KPath addonsKernelPath;
|
||||||
@@ -1133,7 +1140,9 @@ register_preloaded_module_image(struct preloaded_image* image)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
moduleImage->path = strdup(image->name);
|
moduleImage->path = strdup(image->name);
|
||||||
}
|
} else
|
||||||
|
moduleImage->path = strdup(image->name);
|
||||||
|
|
||||||
if (moduleImage->path == NULL) {
|
if (moduleImage->path == NULL) {
|
||||||
status = B_NO_MEMORY;
|
status = B_NO_MEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
|
|||||||
Reference in New Issue
Block a user