mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-12 06:51:16 +00:00
check NULL pointer derefences on overrides and remaps too
This commit is contained in:
parent
c2d85238c2
commit
f120ebab45
@ -1859,19 +1859,19 @@ bool config_load_override(void)
|
|||||||
bool should_append = false;
|
bool should_append = false;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
|
|
||||||
if (!global || !settings || !info)
|
if (!global || !settings || !system)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Couldn't load override config file.\n");
|
RARCH_ERR("Couldn't load override config file.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Early return in case a library isn't loaded */
|
/* Early return in case a library isn't loaded */
|
||||||
if (!info->info.library_name[0] != '\0' || !strcmp(info->info.library_name,"No Core"))
|
if (!system->info.library_name[0] != '\0' || !strcmp(system->info.library_name,"No Core"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RARCH_LOG("Overrides: core name: %s\n", info->info.library_name);
|
RARCH_LOG("Overrides: core name: %s\n", system->info.library_name);
|
||||||
RARCH_LOG("Overrides: game name: %s\n", global->name.base);
|
RARCH_LOG("Overrides: game name: %s\n", global->name.base);
|
||||||
|
|
||||||
/* Config directory: config_directory.
|
/* Config directory: config_directory.
|
||||||
@ -1889,8 +1889,13 @@ bool config_load_override(void)
|
|||||||
|
|
||||||
RARCH_LOG("Overrides: config directory: %s\n", config_directory);
|
RARCH_LOG("Overrides: config directory: %s\n", config_directory);
|
||||||
|
|
||||||
core_name = info->info.library_name;
|
core_name = system ? system->info.library_name : NULL;
|
||||||
game_name = path_basename(global->name.base);
|
game_name = global ? path_basename(global->name.base) : NULL;
|
||||||
|
|
||||||
|
if (!core_name || !game_name)
|
||||||
|
return false;
|
||||||
|
if (core_name[0] == '\0' || game_name == '\0')
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Concatenate strings into full paths for core_path, game_path */
|
/* Concatenate strings into full paths for core_path, game_path */
|
||||||
fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH);
|
fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH);
|
||||||
@ -2046,13 +2051,13 @@ bool config_load_remap(void)
|
|||||||
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
|
|
||||||
/* Early return in case a library isn't loaded or remapping is disabled */
|
/* Early return in case a library isn't loaded or remapping is disabled */
|
||||||
if (!info->info.library_name || !strcmp(info->info.library_name,"No Core"))
|
if (!system->info.library_name || !strcmp(system->info.library_name,"No Core"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RARCH_LOG("Remaps: core name: %s\n", info->info.library_name);
|
RARCH_LOG("Remaps: core name: %s\n", system->info.library_name);
|
||||||
RARCH_LOG("Remaps: game name: %s\n", global->name.base);
|
RARCH_LOG("Remaps: game name: %s\n", global->name.base);
|
||||||
|
|
||||||
/* Remap directory: remap_directory.
|
/* Remap directory: remap_directory.
|
||||||
@ -2066,8 +2071,13 @@ bool config_load_remap(void)
|
|||||||
}
|
}
|
||||||
RARCH_LOG("Remaps: remap directory: %s\n", remap_directory);
|
RARCH_LOG("Remaps: remap directory: %s\n", remap_directory);
|
||||||
|
|
||||||
core_name = info->info.library_name;
|
core_name = system ? system->info.library_name : NULL;
|
||||||
game_name = path_basename(global->name.base);
|
game_name = global ? path_basename(global->name.base) : NULL;
|
||||||
|
|
||||||
|
if (!core_name || !game_name)
|
||||||
|
return false;
|
||||||
|
if (core_name[0] == '\0' || game_name == '\0')
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Concatenate strings into full paths for core_path, game_path */
|
/* Concatenate strings into full paths for core_path, game_path */
|
||||||
fill_pathname_join(core_path, remap_directory, core_name, PATH_MAX_LENGTH);
|
fill_pathname_join(core_path, remap_directory, core_name, PATH_MAX_LENGTH);
|
||||||
|
@ -1246,10 +1246,10 @@ static int action_ok_disk_cycle_tray_status(const char *path,
|
|||||||
return generic_action_ok_command(EVENT_CMD_DISK_EJECT_TOGGLE);
|
return generic_action_ok_command(EVENT_CMD_DISK_EJECT_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* creates folder and core options stub file for subsequent runs */
|
||||||
static int action_ok_option_create(const char *path,
|
static int action_ok_option_create(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
/* create folder and core options stub file for subsequent runs */
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
rarch_system_info_t *system = rarch_system_info_get_ptr();
|
||||||
@ -1273,8 +1273,13 @@ static int action_ok_option_create(const char *path,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core_name = system->info.library_name;
|
core_name = system ? system->info.library_name : NULL;
|
||||||
game_name = path_basename(global->name.base);
|
game_name = global ? path_basename(global->name.base) : NULL;
|
||||||
|
|
||||||
|
if (!core_name || !game_name)
|
||||||
|
return false;
|
||||||
|
if (core_name[0] == '\0' || game_name == '\0')
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Concatenate strings into full paths for game_path */
|
/* Concatenate strings into full paths for game_path */
|
||||||
fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH);
|
fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user