Don't do NULL termination on strings when passing to strlcpy and/or
a file_path function that calls strlcpy under the hood
This commit is contained in:
parent
d5becf92e8
commit
8ac1a36259
7 changed files with 19 additions and 70 deletions
|
@ -919,14 +919,10 @@ bool audio_driver_dsp_filter_init(const char *device)
|
||||||
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
|
||||||
char ext_name[32];
|
char ext_name[32];
|
||||||
char basedir[256];
|
char basedir[256];
|
||||||
|
ext_name[0] = '\0';
|
||||||
basedir[0] = ext_name[0] = '\0';
|
|
||||||
|
|
||||||
fill_pathname_basedir(basedir, device, sizeof(basedir));
|
fill_pathname_basedir(basedir, device, sizeof(basedir));
|
||||||
|
|
||||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(plugs = dir_list_new(basedir, ext_name, false, true, false, false)))
|
if (!(plugs = dir_list_new(basedir, ext_name, false, true, false, false)))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1358,8 +1354,7 @@ void audio_driver_load_system_sounds(void)
|
||||||
if (!audio_enable_menu && !audio_enable_cheevo_unlock)
|
if (!audio_enable_menu && !audio_enable_cheevo_unlock)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
sounds_path[0] = sounds_fallback_path[0] =
|
sounds_path[0] = basename_noext[0] ='\0';
|
||||||
basename_noext[0] ='\0';
|
|
||||||
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
sounds_fallback_path,
|
sounds_fallback_path,
|
||||||
|
|
|
@ -797,13 +797,8 @@ static void gfx_widgets_layout(
|
||||||
{
|
{
|
||||||
char ozone_path[PATH_MAX_LENGTH];
|
char ozone_path[PATH_MAX_LENGTH];
|
||||||
char font_file[PATH_MAX_LENGTH];
|
char font_file[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
ozone_path[0] = '\0';
|
|
||||||
font_file[0] = '\0';
|
|
||||||
|
|
||||||
/* Base path */
|
/* Base path */
|
||||||
fill_pathname_join(ozone_path, dir_assets, "ozone", sizeof(ozone_path));
|
fill_pathname_join(ozone_path, dir_assets, "ozone", sizeof(ozone_path));
|
||||||
|
|
||||||
/* Create regular font */
|
/* Create regular font */
|
||||||
fill_pathname_join(font_file, ozone_path, "regular.ttf", sizeof(font_file));
|
fill_pathname_join(font_file, ozone_path, "regular.ttf", sizeof(font_file));
|
||||||
gfx_widgets_font_init(p_disp, p_dispwidget,
|
gfx_widgets_font_init(p_disp, p_dispwidget,
|
||||||
|
@ -1899,35 +1894,24 @@ static void gfx_widgets_context_reset(
|
||||||
char monochrome_png_path[PATH_MAX_LENGTH];
|
char monochrome_png_path[PATH_MAX_LENGTH];
|
||||||
char gfx_widgets_path[PATH_MAX_LENGTH];
|
char gfx_widgets_path[PATH_MAX_LENGTH];
|
||||||
char theme_path[PATH_MAX_LENGTH];
|
char theme_path[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
xmb_path[0] = '\0';
|
|
||||||
monochrome_png_path[0] = '\0';
|
|
||||||
gfx_widgets_path[0] = '\0';
|
|
||||||
theme_path[0] = '\0';
|
|
||||||
|
|
||||||
/* Textures paths */
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
gfx_widgets_path,
|
gfx_widgets_path,
|
||||||
dir_assets,
|
dir_assets,
|
||||||
"menu_widgets",
|
"menu_widgets",
|
||||||
sizeof(gfx_widgets_path)
|
sizeof(gfx_widgets_path)
|
||||||
);
|
);
|
||||||
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
xmb_path,
|
xmb_path,
|
||||||
dir_assets,
|
dir_assets,
|
||||||
"xmb",
|
"xmb",
|
||||||
sizeof(xmb_path)
|
sizeof(xmb_path)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Monochrome */
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
theme_path,
|
theme_path,
|
||||||
xmb_path,
|
xmb_path,
|
||||||
"monochrome",
|
"monochrome",
|
||||||
sizeof(theme_path)
|
sizeof(theme_path)
|
||||||
);
|
);
|
||||||
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
monochrome_png_path,
|
monochrome_png_path,
|
||||||
theme_path,
|
theme_path,
|
||||||
|
|
|
@ -2135,7 +2135,7 @@ void input_config_get_bind_string(
|
||||||
)
|
)
|
||||||
*key = '\0';
|
*key = '\0';
|
||||||
/*empty?*/
|
/*empty?*/
|
||||||
if (*key != '\0')
|
else if (*key != '\0')
|
||||||
{
|
{
|
||||||
char keybuf[64];
|
char keybuf[64];
|
||||||
|
|
||||||
|
@ -2922,9 +2922,6 @@ void input_config_set_device_config_path(unsigned port, const char *path)
|
||||||
{
|
{
|
||||||
char parent_dir_name[128];
|
char parent_dir_name[128];
|
||||||
input_driver_state_t *input_st = &input_driver_st;
|
input_driver_state_t *input_st = &input_driver_st;
|
||||||
|
|
||||||
parent_dir_name[0] = '\0';
|
|
||||||
|
|
||||||
if (fill_pathname_parent_dir_name(parent_dir_name,
|
if (fill_pathname_parent_dir_name(parent_dir_name,
|
||||||
path, sizeof(parent_dir_name)))
|
path, sizeof(parent_dir_name)))
|
||||||
fill_pathname_join(input_st->input_device_info[port].config_path,
|
fill_pathname_join(input_st->input_device_info[port].config_path,
|
||||||
|
@ -4651,9 +4648,7 @@ static bool runloop_check_movie_init(input_driver_state_t *input_st,
|
||||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||||
path);
|
path);
|
||||||
|
|
||||||
state = bsv_movie_init_internal(path, RARCH_MOVIE_RECORD);
|
if (!(state = bsv_movie_init_internal(path, RARCH_MOVIE_RECORD)))
|
||||||
|
|
||||||
if (!state)
|
|
||||||
{
|
{
|
||||||
runloop_msg_queue_push(
|
runloop_msg_queue_push(
|
||||||
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
|
msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD),
|
||||||
|
|
|
@ -246,9 +246,6 @@ runtime_log_t *runtime_log_init(
|
||||||
|
|
||||||
content_name[0] = '\0';
|
content_name[0] = '\0';
|
||||||
core_name[0] = '\0';
|
core_name[0] = '\0';
|
||||||
log_file_dir[0] = '\0';
|
|
||||||
log_file_path[0] = '\0';
|
|
||||||
tmp_buf[0] = '\0';
|
|
||||||
|
|
||||||
if ( string_is_empty(dir_runtime_log) &&
|
if ( string_is_empty(dir_runtime_log) &&
|
||||||
string_is_empty(dir_playlist))
|
string_is_empty(dir_playlist))
|
||||||
|
@ -281,17 +278,15 @@ runtime_log_t *runtime_log_init(
|
||||||
if (string_is_empty(core_name))
|
if (string_is_empty(core_name))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Get runtime log directory */
|
/* Get runtime log directory
|
||||||
|
* If 'custom' runtime log path is undefined,
|
||||||
|
* use default 'playlists/logs' directory... */
|
||||||
if (string_is_empty(dir_runtime_log))
|
if (string_is_empty(dir_runtime_log))
|
||||||
{
|
|
||||||
/* If 'custom' runtime log path is undefined,
|
|
||||||
* use default 'playlists/logs' directory... */
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
tmp_buf,
|
tmp_buf,
|
||||||
dir_playlist,
|
dir_playlist,
|
||||||
"logs",
|
"logs",
|
||||||
sizeof(tmp_buf));
|
sizeof(tmp_buf));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
strlcpy(tmp_buf, dir_runtime_log, sizeof(tmp_buf));
|
strlcpy(tmp_buf, dir_runtime_log, sizeof(tmp_buf));
|
||||||
|
|
||||||
|
@ -1362,14 +1357,12 @@ void runtime_update_playlist(
|
||||||
playlist_get_index(playlist, idx, &entry);
|
playlist_get_index(playlist, idx, &entry);
|
||||||
|
|
||||||
/* Attempt to open log file */
|
/* Attempt to open log file */
|
||||||
runtime_log = runtime_log_init(
|
if ((runtime_log = runtime_log_init(
|
||||||
entry->path,
|
entry->path,
|
||||||
entry->core_path,
|
entry->core_path,
|
||||||
dir_runtime_log,
|
dir_runtime_log,
|
||||||
dir_playlist,
|
dir_playlist,
|
||||||
log_per_core);
|
log_per_core)))
|
||||||
|
|
||||||
if (runtime_log)
|
|
||||||
{
|
{
|
||||||
/* Check whether a non-zero runtime has been recorded */
|
/* Check whether a non-zero runtime has been recorded */
|
||||||
if (runtime_log_has_runtime(runtime_log))
|
if (runtime_log_has_runtime(runtime_log))
|
||||||
|
|
|
@ -261,9 +261,7 @@ static int task_database_cue_get_serial(const char *name, char* serial)
|
||||||
|
|
||||||
track_path[0] = '\0';
|
track_path[0] = '\0';
|
||||||
|
|
||||||
rv = cue_find_track(name, true, &offset, &size, track_path, sizeof(track_path));
|
if ((rv = cue_find_track(name, true, &offset, &size, track_path, sizeof(track_path))) < 0)
|
||||||
|
|
||||||
if (rv < 0)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
RARCH_LOG("%s: %s\n",
|
RARCH_LOG("%s: %s\n",
|
||||||
|
@ -287,9 +285,8 @@ static int task_database_gdi_get_serial(const char *name, char* serial)
|
||||||
|
|
||||||
track_path[0] = '\0';
|
track_path[0] = '\0';
|
||||||
|
|
||||||
rv = gdi_find_track(name, true, track_path, sizeof(track_path));
|
if ((rv = gdi_find_track(name, true,
|
||||||
|
track_path, sizeof(track_path))) < 0)
|
||||||
if (rv < 0)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
RARCH_LOG("%s: %s\n",
|
RARCH_LOG("%s: %s\n",
|
||||||
|
@ -391,10 +388,8 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||||
|
|
||||||
track_path[0] = '\0';
|
track_path[0] = '\0';
|
||||||
|
|
||||||
rv = cue_find_track(name, false, &offset, &size,
|
if ((rv = cue_find_track(name, false, &offset, &size,
|
||||||
track_path, sizeof(track_path));
|
track_path, sizeof(track_path))) < 0)
|
||||||
|
|
||||||
if (rv < 0)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
RARCH_LOG("%s: %s\n",
|
RARCH_LOG("%s: %s\n",
|
||||||
|
@ -424,9 +419,8 @@ static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||||
|
|
||||||
track_path[0] = '\0';
|
track_path[0] = '\0';
|
||||||
|
|
||||||
rv = gdi_find_track(name, true, track_path, sizeof(track_path));
|
if ((rv = gdi_find_track(name, true,
|
||||||
|
track_path, sizeof(track_path))) < 0)
|
||||||
if (rv < 0)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||||
|
@ -749,7 +743,6 @@ static int database_info_list_iterate_found_match(
|
||||||
|
|
||||||
db_crc[0] = '\0';
|
db_crc[0] = '\0';
|
||||||
db_playlist_path[0] = '\0';
|
db_playlist_path[0] = '\0';
|
||||||
db_playlist_base_str[0] = '\0';
|
|
||||||
entry_path_str[0] = '\0';
|
entry_path_str[0] = '\0';
|
||||||
|
|
||||||
fill_pathname(db_playlist_base_str,
|
fill_pathname(db_playlist_base_str,
|
||||||
|
@ -771,9 +764,7 @@ static int database_info_list_iterate_found_match(
|
||||||
RARCH_ERR("Serial string encoding error\n");
|
RARCH_ERR("Serial string encoding error\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
snprintf(db_crc, str_len, "%08lX|crc", (unsigned long)db_info_entry->crc32);
|
snprintf(db_crc, str_len, "%08lX|crc", (unsigned long)db_info_entry->crc32);
|
||||||
}
|
|
||||||
|
|
||||||
if (entry_path)
|
if (entry_path)
|
||||||
strlcpy(entry_path_str, entry_path, str_len);
|
strlcpy(entry_path_str, entry_path, str_len);
|
||||||
|
@ -1005,9 +996,6 @@ static int task_database_iterate_playlist_lutro(
|
||||||
{
|
{
|
||||||
struct playlist_entry entry;
|
struct playlist_entry entry;
|
||||||
char game_title[PATH_MAX_LENGTH];
|
char game_title[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
game_title[0] = '\0';
|
|
||||||
|
|
||||||
fill_pathname(game_title,
|
fill_pathname(game_title,
|
||||||
path_basename(path), "", sizeof(game_title));
|
path_basename(path), "", sizeof(game_title));
|
||||||
path_remove_extension(game_title);
|
path_remove_extension(game_title);
|
||||||
|
|
|
@ -499,8 +499,7 @@ int detect_scd_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||||
{
|
{
|
||||||
if (!strcmp(region_id, "U") || !strcmp(region_id, "J"))
|
if (!strcmp(region_id, "U") || !strcmp(region_id, "J"))
|
||||||
{
|
{
|
||||||
index = string_index_last_occurance(pre_game_id, hyphen);
|
if ((index = string_index_last_occurance(pre_game_id, hyphen)) == -1)
|
||||||
if (index == -1)
|
|
||||||
return false;
|
return false;
|
||||||
strncpy(game_id, pre_game_id, index);
|
strncpy(game_id, pre_game_id, index);
|
||||||
game_id[index] = '\0';
|
game_id[index] = '\0';
|
||||||
|
@ -509,8 +508,7 @@ int detect_scd_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
index = string_index_last_occurance(pre_game_id, hyphen);
|
if ((index = string_index_last_occurance(pre_game_id, hyphen)) == -1)
|
||||||
if (index == -1)
|
|
||||||
return false;
|
return false;
|
||||||
strncpy(lgame_id, pre_game_id, index);
|
strncpy(lgame_id, pre_game_id, index);
|
||||||
lgame_id[index] = '\0';
|
lgame_id[index] = '\0';
|
||||||
|
@ -522,8 +520,7 @@ int detect_scd_game(intfstream_t *fd, char *game_id, const char *filename)
|
||||||
}
|
}
|
||||||
else if (!strcmp(check_prefix_g_hyp, "G-"))
|
else if (!strcmp(check_prefix_g_hyp, "G-"))
|
||||||
{
|
{
|
||||||
index = string_index_last_occurance(pre_game_id, hyphen);
|
if ((index = string_index_last_occurance(pre_game_id, hyphen)) == -1)
|
||||||
if (index == -1)
|
|
||||||
return false;
|
return false;
|
||||||
strncpy(game_id, pre_game_id, index);
|
strncpy(game_id, pre_game_id, index);
|
||||||
game_id[index] = '\0';
|
game_id[index] = '\0';
|
||||||
|
|
|
@ -87,9 +87,6 @@ static void task_overlay_load_desc_image(
|
||||||
{
|
{
|
||||||
struct texture_image image_tex;
|
struct texture_image image_tex;
|
||||||
char path[PATH_MAX_LENGTH];
|
char path[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
path[0] = '\0';
|
|
||||||
|
|
||||||
fill_pathname_resolve_relative(path, loader->overlay_path,
|
fill_pathname_resolve_relative(path, loader->overlay_path,
|
||||||
image_path, sizeof(path));
|
image_path, sizeof(path));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue