diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index dfb5bdaac9f..c8ff0139091 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -328,7 +328,7 @@ bool path_is_compressed_file(const char* path) size_t fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size) { - size_t _len, _len2; + size_t _len; char tmp_path[PATH_MAX_LENGTH]; char *tok = NULL; strlcpy(tmp_path, in_path, sizeof(tmp_path)); @@ -336,8 +336,8 @@ size_t fill_pathname(char *out_path, const char *in_path, *tok = '\0'; _len = strlcpy(out_path, tmp_path, size); - _len2 = strlcpy(out_path + _len, replace, size - _len); - return _len + _len2; + _len += strlcpy(out_path + _len, replace, size - _len); + return _len; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index bf9e567b583..ccf1e835a60 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2252,6 +2252,7 @@ static int menu_displaylist_parse_playlist( if (!string_is_empty(entry->path)) { + size_t _len; /* Standard playlist entry * > Base menu entry label is always playlist label * > If playlist label is NULL, fallback to playlist entry file name @@ -2259,10 +2260,13 @@ static int menu_displaylist_parse_playlist( * no further action is necessary */ if (string_is_empty(entry->label)) - fill_pathname(menu_entry_label, - path_basename(entry->path), "", sizeof(menu_entry_label)); + _len = fill_pathname(menu_entry_label, + path_basename(entry->path), "", + sizeof(menu_entry_label)); else - strlcpy(menu_entry_label, entry->label, sizeof(menu_entry_label)); + _len = strlcpy(menu_entry_label, + entry->label, + sizeof(menu_entry_label)); if (sanitization) (*sanitization)(menu_entry_label); @@ -2275,8 +2279,13 @@ static int menu_displaylist_parse_playlist( && !string_is_empty(entry->core_path) && !string_is_equal(entry->core_path, "DETECT")) { - strlcat(menu_entry_label, label_spacer, sizeof(menu_entry_label)); - strlcat(menu_entry_label, entry->core_name, sizeof(menu_entry_label)); + _len += strlcpy( + menu_entry_label + _len, + label_spacer, + sizeof(menu_entry_label) - _len); + strlcpy(menu_entry_label + _len, + entry->core_name, + sizeof(menu_entry_label) - _len); } }