mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +00:00
(PS3/RARCH_CONSOLE) Replace strncpys with strlcpys
This commit is contained in:
parent
15b7e0fafc
commit
c4e0e45722
@ -91,7 +91,7 @@ const char * path, const char * extensions)
|
||||
if(!(ffd.dwFileAttributes & FS_TYPES_DIRECTORY))
|
||||
{
|
||||
char tmp_extensions[512];
|
||||
strncpy(tmp_extensions, extensions, sizeof(tmp_extensions));
|
||||
strlcpy(tmp_extensions, extensions, sizeof(tmp_extensions));
|
||||
const char * current_extension = filebrowser_get_extension(ffd.cFileName);
|
||||
bool found_rom = false;
|
||||
|
||||
@ -158,7 +158,7 @@ const char * path, const char * extensions)
|
||||
if (dirent.d_type == FS_TYPES_FILE)
|
||||
{
|
||||
char tmp_extensions[512];
|
||||
strncpy(tmp_extensions, extensions, sizeof(tmp_extensions));
|
||||
strlcpy(tmp_extensions, extensions, sizeof(tmp_extensions));
|
||||
const char * current_extension = filebrowser_get_extension(dirent.d_name);
|
||||
bool found_rom = false;
|
||||
|
||||
|
@ -1415,7 +1415,7 @@ int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
|
||||
break;
|
||||
|
||||
case RSD_IDENTITY:
|
||||
strncpy(rd->identity, param, sizeof(rd->identity));
|
||||
strlcpy(rd->identity, param, sizeof(rd->identity));
|
||||
rd->identity[sizeof(rd->identity)-1] = '\0';
|
||||
break;
|
||||
|
||||
|
@ -343,7 +343,7 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
char dirName[CELL_GAME_DIRNAME_SIZE];
|
||||
CellSysCacheParam param;
|
||||
memset(¶m, 0x00, sizeof(CellSysCacheParam));
|
||||
strncpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));
|
||||
strlcpy(param.cacheId,CACHE_ID, sizeof(CellSysCacheParam));
|
||||
|
||||
ret = cellSysCacheMount(¶m);
|
||||
if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
|
||||
@ -354,12 +354,12 @@ static void get_environment_settings(int argc, char *argv[])
|
||||
if(argc > 1)
|
||||
{
|
||||
/* launched from external launcher */
|
||||
strncpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
|
||||
strlcpy(MULTIMAN_EXECUTABLE, argv[2], sizeof(MULTIMAN_EXECUTABLE));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* not launched from external launcher, set default path */
|
||||
strncpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
||||
strlcpy(MULTIMAN_EXECUTABLE, "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF",
|
||||
sizeof(MULTIMAN_EXECUTABLE));
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
case EXTERN_LAUNCHER_MULTIMAN:
|
||||
RARCH_LOG("Started from multiMAN, will auto-start game.\n");
|
||||
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
|
||||
strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
|
||||
g_console.initialize_rarch_enable = 1;
|
||||
g_console.mode_switch = MODE_EMULATION;
|
||||
rarch_startup(SYS_CONFIG_FILE);
|
||||
|
60
ps3/menu.c
60
ps3/menu.c
@ -815,43 +815,43 @@ static void select_file(uint32_t menu_id)
|
||||
switch(menu_id)
|
||||
{
|
||||
case SHADER_CHOICE:
|
||||
strncpy(dir_path, SHADERS_DIR_PATH, sizeof(dir_path));
|
||||
strncpy(extensions, "cg|CG", sizeof(extensions));
|
||||
strncpy(title, "SHADER SELECTION", sizeof(title));
|
||||
strncpy(object, "Shader", sizeof(object));
|
||||
strncpy(comment, "INFO - Select a shader from the menu by pressing the X button.", sizeof(comment));
|
||||
strlcpy(dir_path, SHADERS_DIR_PATH, sizeof(dir_path));
|
||||
strlcpy(extensions, "cg|CG", sizeof(extensions));
|
||||
strlcpy(title, "SHADER SELECTION", sizeof(title));
|
||||
strlcpy(object, "Shader", sizeof(object));
|
||||
strlcpy(comment, "INFO - Select a shader from the menu by pressing the X button.", sizeof(comment));
|
||||
break;
|
||||
case PRESET_CHOICE:
|
||||
strncpy(dir_path, PRESETS_DIR_PATH, sizeof(dir_path));
|
||||
strncpy(extensions, "cgp|CGP", sizeof(extensions));
|
||||
strncpy(title, "SHADER PRESETS SELECTION", sizeof(title));
|
||||
strncpy(object, "Shader", sizeof(object));
|
||||
strncpy(object, "Shader preset", sizeof(object));
|
||||
strncpy(comment, "INFO - Select a shader preset from the menu by pressing the X button.", sizeof(comment));
|
||||
strlcpy(dir_path, PRESETS_DIR_PATH, sizeof(dir_path));
|
||||
strlcpy(extensions, "cgp|CGP", sizeof(extensions));
|
||||
strlcpy(title, "SHADER PRESETS SELECTION", sizeof(title));
|
||||
strlcpy(object, "Shader", sizeof(object));
|
||||
strlcpy(object, "Shader preset", sizeof(object));
|
||||
strlcpy(comment, "INFO - Select a shader preset from the menu by pressing the X button.", sizeof(comment));
|
||||
break;
|
||||
case INPUT_PRESET_CHOICE:
|
||||
strncpy(dir_path, INPUT_PRESETS_DIR_PATH, sizeof(dir_path));
|
||||
strncpy(extensions, "cfg|CFG", sizeof(extensions));
|
||||
strncpy(title, "INPUT PRESETS SELECTION", sizeof(title));
|
||||
strncpy(object, "Input", sizeof(object));
|
||||
strncpy(object, "Input preset", sizeof(object));
|
||||
strncpy(comment, "INFO - Select an input preset from the menu by pressing the X button.", sizeof(comment));
|
||||
strlcpy(dir_path, INPUT_PRESETS_DIR_PATH, sizeof(dir_path));
|
||||
strlcpy(extensions, "cfg|CFG", sizeof(extensions));
|
||||
strlcpy(title, "INPUT PRESETS SELECTION", sizeof(title));
|
||||
strlcpy(object, "Input", sizeof(object));
|
||||
strlcpy(object, "Input preset", sizeof(object));
|
||||
strlcpy(comment, "INFO - Select an input preset from the menu by pressing the X button.", sizeof(comment));
|
||||
break;
|
||||
case BORDER_CHOICE:
|
||||
strncpy(dir_path, BORDERS_DIR_PATH, sizeof(dir_path));
|
||||
strncpy(extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(extensions));
|
||||
strncpy(title, "BORDER SELECTION", sizeof(title));
|
||||
strncpy(object, "Border", sizeof(object));
|
||||
strncpy(object, "Border image file", sizeof(object));
|
||||
strncpy(comment, "INFO - Select a border image file from the menu by pressing the X button.", sizeof(comment));
|
||||
strlcpy(dir_path, BORDERS_DIR_PATH, sizeof(dir_path));
|
||||
strlcpy(extensions, "png|PNG|jpg|JPG|JPEG|jpeg", sizeof(extensions));
|
||||
strlcpy(title, "BORDER SELECTION", sizeof(title));
|
||||
strlcpy(object, "Border", sizeof(object));
|
||||
strlcpy(object, "Border image file", sizeof(object));
|
||||
strlcpy(comment, "INFO - Select a border image file from the menu by pressing the X button.", sizeof(comment));
|
||||
break;
|
||||
case LIBRETRO_CHOICE:
|
||||
strncpy(dir_path, LIBRETRO_DIR_PATH, sizeof(dir_path));
|
||||
strncpy(extensions, "self|SELF|bin|BIN", sizeof(extensions));
|
||||
strncpy(title, "LIBRETRO CORE SELECTION", sizeof(title));
|
||||
strncpy(object, "Libretro", sizeof(object));
|
||||
strncpy(object, "Libretro core library", sizeof(object));
|
||||
strncpy(comment, "INFO - Select a Libretro core from the menu by pressing the X button.", sizeof(comment));
|
||||
strlcpy(dir_path, LIBRETRO_DIR_PATH, sizeof(dir_path));
|
||||
strlcpy(extensions, "self|SELF|bin|BIN", sizeof(extensions));
|
||||
strlcpy(title, "LIBRETRO CORE SELECTION", sizeof(title));
|
||||
strlcpy(object, "Libretro", sizeof(object));
|
||||
strlcpy(object, "Libretro core library", sizeof(object));
|
||||
strlcpy(comment, "INFO - Select a Libretro core from the menu by pressing the X button.", sizeof(comment));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1086,7 +1086,7 @@ static void rarch_filename_input_and_save (unsigned filename_type)
|
||||
|
||||
if(g_console.oskutil_handle.text_can_be_fetched)
|
||||
{
|
||||
strncpy(filename_tmp, OUTPUT_TEXT_STRING(g_console.oskutil_handle), sizeof(filename_tmp));
|
||||
strlcpy(filename_tmp, OUTPUT_TEXT_STRING(g_console.oskutil_handle), sizeof(filename_tmp));
|
||||
switch(filename_type)
|
||||
{
|
||||
case CONFIG_FILE:
|
||||
|
@ -40,7 +40,7 @@ static void start_ssnes(const char *path)
|
||||
{
|
||||
char arg0[] = "ssnes";
|
||||
char arg1[256];
|
||||
strncpy(arg1, path, sizeof(arg1));
|
||||
strlcpy(arg1, path, sizeof(arg1));
|
||||
char *argv[3] = { arg0, arg1, NULL };
|
||||
rarch_main(sizeof(argv) / sizeof(argv[0]) - 1, argv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user