diff --git a/configuration.c b/configuration.c index b337a7738b..f30f2b39a9 100644 --- a/configuration.c +++ b/configuration.c @@ -4475,7 +4475,7 @@ bool config_load_override(void *data) char tmp_path[PATH_MAX_LENGTH]; size_t _len = strlcpy(tmp_path, path_get(RARCH_PATH_CONFIG_OVERRIDE), - sizeof(tmp_path)); + sizeof(tmp_path) - 2); tmp_path[ _len] = '|'; tmp_path[++_len] = '\0'; strlcpy(tmp_path + _len, core_path, sizeof(tmp_path) - _len); @@ -4503,7 +4503,7 @@ bool config_load_override(void *data) char tmp_path[PATH_MAX_LENGTH]; size_t _len = strlcpy(tmp_path, path_get(RARCH_PATH_CONFIG_OVERRIDE), - sizeof(tmp_path)); + sizeof(tmp_path) - 2); tmp_path[ _len] = '|'; tmp_path[++_len] = '\0'; strlcpy(tmp_path + _len, content_path, sizeof(tmp_path) - _len); @@ -4529,7 +4529,7 @@ bool config_load_override(void *data) char tmp_path[PATH_MAX_LENGTH]; size_t _len = strlcpy(tmp_path, path_get(RARCH_PATH_CONFIG_OVERRIDE), - sizeof(tmp_path)); + sizeof(tmp_path) - 2); tmp_path[ _len] = '|'; tmp_path[++_len] = '\0'; strlcpy(tmp_path + _len, game_path, sizeof(tmp_path) - _len); diff --git a/core_option_manager.c b/core_option_manager.c index d72fb8b784..d0f6896d95 100644 --- a/core_option_manager.c +++ b/core_option_manager.c @@ -1204,7 +1204,7 @@ core_option_manager_t *core_option_manager_new( } else { - size_t __len = strlcpy(address, category_key, sizeof(address)); + size_t __len = strlcpy(address, category_key, sizeof(address) - 3); address[ __len] = ':'; address[++__len] = '#'; address[++__len] = '\0'; diff --git a/disk_control_interface.c b/disk_control_interface.c index cec617fb94..a5f1541f86 100644 --- a/disk_control_interface.c +++ b/disk_control_interface.c @@ -623,7 +623,7 @@ bool disk_control_append_image( goto error; /* Display log */ - _len = strlcpy(msg, msg_hash_to_str(MSG_APPENDED_DISK), sizeof(msg)); + _len = strlcpy(msg, msg_hash_to_str(MSG_APPENDED_DISK), sizeof(msg) - 3); msg[ _len] = ':'; msg[++_len] = ' '; msg[++_len] = '\0'; @@ -653,7 +653,7 @@ error: disk_control_set_eject_state(disk_control, false, false); _len = strlcpy(msg, - msg_hash_to_str(MSG_FAILED_TO_APPEND_DISK), sizeof(msg)); + msg_hash_to_str(MSG_FAILED_TO_APPEND_DISK), sizeof(msg) - 3); msg[ _len] = ':'; msg[++_len] = ' '; msg[++_len] = '\0'; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index c304b00a34..4d6b2fd074 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -4692,7 +4692,7 @@ static void rgui_render_osk( * If OSK cannot physically fit on the screen, * fallback to old style 'message box' implementation */ char msg[NAME_MAX_LENGTH]; - size_t _len = strlcpy(msg, input_label, sizeof(msg)); + size_t _len = strlcpy(msg, input_label, sizeof(msg) - 2); msg[ _len] = '\n'; msg[++_len] = '\0'; strlcpy(msg + _len, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 4c83444263..9597d2396d 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -8418,7 +8418,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) { const char *str = menu_input_dialog_get_buffer(); const char *label = menu_st->input_dialog_kb_label; - size_t _len = strlcpy(msg, label, sizeof(msg)); + size_t _len = strlcpy(msg, label, sizeof(msg) - 2); msg[ _len] = '\n'; msg[++_len] = '\0'; strlcpy(msg + _len, diff --git a/menu/menu_contentless_cores.c b/menu/menu_contentless_cores.c index db5beed128..f1b4b24c27 100644 --- a/menu/menu_contentless_cores.c +++ b/menu/menu_contentless_cores.c @@ -124,7 +124,7 @@ static void contentless_cores_init_info_entries( (contentless_core_info_entry_t*)malloc(sizeof(*entry)); size_t _len = strlcpy(licenses_str, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), - sizeof(licenses_str)); + sizeof(licenses_str) - 3); licenses_str[ _len] = ':'; licenses_str[++_len] = ' '; licenses_str[++_len] = '\0'; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1200aac708..bf3507c565 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5238,7 +5238,7 @@ static unsigned menu_displaylist_parse_content_information( { const char *cheevos_hash_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH); - size_t _len = strlcpy(tmp, cheevos_hash_str, sizeof(tmp)); + size_t _len = strlcpy(tmp, cheevos_hash_str, sizeof(tmp) - 4); tmp[ _len] = ':'; tmp[++_len] = ' '; tmp[++_len] = '\n'; diff --git a/tasks/task_content.c b/tasks/task_content.c index fa7eab06c1..b96d30b5d1 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -867,7 +867,7 @@ static void content_file_get_path( char info_path[PATH_MAX_LENGTH]; /* Build 'complete' archive file path */ size_t _len = strlcpy(info_path, - content_path, sizeof(info_path)); + content_path, sizeof(info_path) - 2); info_path[_len ] = '#'; info_path[_len+1] = '\0'; _len += 1; diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index e01557ced3..5c9828ec48 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -855,7 +855,7 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename) lgame_id[1] = '\0'; strncpy(rgame_id, &raw_game_id[1], __len - 1); rgame_id[__len - 1] = '\0'; - _len = strlcpy(pre_game_id, lgame_id, sizeof(pre_game_id)); + _len = strlcpy(pre_game_id, lgame_id, sizeof(pre_game_id) - 2); pre_game_id[ _len] = '-'; pre_game_id[++_len] = '\0'; strlcpy(pre_game_id + _len, rgame_id, sizeof(pre_game_id) - _len); diff --git a/tasks/task_save.c b/tasks/task_save.c index f41a492ee5..0f867f38d0 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -558,7 +558,7 @@ static void task_save_handler(retro_task_t *task) { size_t _len = strlcpy(msg, msg_hash_to_str(MSG_FAILED_TO_SAVE_STATE_TO), - sizeof(msg)); + sizeof(msg) - 2); msg[ _len] = ' '; msg[++_len] = '\0'; strlcpy(msg + _len, state->path, sizeof(msg) - _len);