(netplay_find_content.c) Try to use strlcpy where possible

This commit is contained in:
twinaphex 2017-01-25 02:00:44 +01:00
parent 071c4c1f3f
commit 5577b21f95
1 changed files with 12 additions and 13 deletions

View File

@ -200,27 +200,26 @@ bool task_push_netplay_crc_scan(uint32_t crc, char* name,
const char *hostname, const char *core_name)
{
int i;
core_info_list_t *info = NULL;
settings_t *settings = config_get_ptr();
retro_task_t *task = (retro_task_t *)calloc(1, sizeof(*task));
netplay_crc_handle_t *state = (netplay_crc_handle_t*)calloc(1, sizeof(*state));
core_info_list_t *info = NULL;
core_info_get_list(&info);
core_info_get_list(&info);
if (!task || !state)
goto error;
state->content_crc[0] = '\0';
snprintf(state->content_crc, sizeof(state->content_crc), "%08X|crc", crc);
state->content_crc[0] = '\0';
state->content_path[0] = '\0';
snprintf(state->content_path, sizeof(state->content_path), "%s", name);
state->hostname[0] = '\0';
state->core_name[0] = '\0';
state->hostname[0] = '\0';
snprintf(state->hostname, sizeof(state->hostname), "%s", hostname);
snprintf(state->content_crc, sizeof(state->content_crc), "%08X|crc", crc);
state->core_name[0] = '\0';
snprintf(state->core_name, sizeof(state->core_name), "%s", core_name);
strlcpy(state->content_path, name, sizeof(state->content_path));
strlcpy(state->hostname, hostname, sizeof(state->hostname));
strlcpy(state->core_name, core_name, sizeof(state->core_name));
state->lpl_list = dir_list_new(settings->directory.playlist,
NULL, true, true, true, false);
@ -234,13 +233,13 @@ bool task_push_netplay_crc_scan(uint32_t crc, char* name,
if the version string matches too */
if(string_is_equal(info->list[i].core_name, state->core_name))
{
snprintf(state->core_path, sizeof(state->core_path), "%s", info->list[i].path);
snprintf(state->core_extensions, sizeof(state->core_extensions), "%s", info->list[i].supported_extensions);
strlcpy(state->core_path, info->list[i].path, sizeof(state->core_path));
strlcpy(state->core_extensions,
info->list[i].supported_extensions, sizeof(state->core_extensions));
break;
}
}
/* blocking means no other task can run while this one is running,
* which is the default */
task->type = TASK_TYPE_BLOCKING;