From 3417d98405ccb70c0b3971be6b9a41faed2ef98c Mon Sep 17 00:00:00 2001 From: twinaphex <libretro@gmail.com> Date: Sat, 13 Jun 2015 03:06:11 +0200 Subject: [PATCH] (General) Cleanups --- core_info.c | 19 ++++++++++++------- netplay.c | 1 + retroarch.c | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core_info.c b/core_info.c index 836c440e55..959da20c7e 100644 --- a/core_info.c +++ b/core_info.c @@ -87,7 +87,9 @@ static void core_info_list_resolve_all_firmware( for (c = 0; c < count; c++) { - char path_key[64], desc_key[64], opt_key[64]; + char path_key[64] = {0}; + char desc_key[64] = {0}; + char opt_key[64] = {0}; snprintf(path_key, sizeof(path_key), "firmware%u_path", c); snprintf(desc_key, sizeof(desc_key), "firmware%u_desc", c); @@ -124,7 +126,9 @@ void core_info_get_name(const char *path, char *s, size_t len) for (i = 0; i < contents->size; i++) { - char info_path_base[PATH_MAX_LENGTH], info_path[PATH_MAX_LENGTH]; + char info_path_base[PATH_MAX_LENGTH] = {0}; + char info_path[PATH_MAX_LENGTH] = {0}; + core_info[i].path = strdup(contents->elems[i].data); if (!core_info[i].path) @@ -189,7 +193,8 @@ core_info_list_t *core_info_list_new(void) for (i = 0; i < contents->size; i++) { - char info_path_base[PATH_MAX_LENGTH], info_path[PATH_MAX_LENGTH]; + char info_path_base[PATH_MAX_LENGTH] = {0}; + char info_path[PATH_MAX_LENGTH] = {0}; core_info[i].path = strdup(contents->elems[i].data); if (!core_info[i].path) @@ -527,8 +532,8 @@ void core_info_list_update_missing_firmware(core_info_list_t *core_info_list, const char *core, const char *systemdir) { size_t i; - char path[PATH_MAX_LENGTH]; - core_info_t *info = NULL; + char path[PATH_MAX_LENGTH] = {0}; + core_info_t *info = NULL; if (!core_info_list || !core) return; @@ -552,8 +557,8 @@ void core_info_list_get_missing_firmware(core_info_list_t *core_info_list, const core_info_firmware_t **firmware, size_t *num_firmware) { size_t i; - char path[PATH_MAX_LENGTH]; - core_info_t *info = NULL; + char path[PATH_MAX_LENGTH] = {0}; + core_info_t *info = NULL; if (!core_info_list || !core) return; diff --git a/netplay.c b/netplay.c index b0ab4fa5f3..7227aaac64 100644 --- a/netplay.c +++ b/netplay.c @@ -611,6 +611,7 @@ static void log_connection(const struct sockaddr_storage *their_addr, if (str) { char msg[512] = {0}; + snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)", nick, str, slot); rarch_main_msg_queue_push(msg, 1, 180, false); diff --git a/retroarch.c b/retroarch.c index a01ed3f88a..0ee4d286c5 100644 --- a/retroarch.c +++ b/retroarch.c @@ -850,7 +850,8 @@ static void rarch_init_savefile_paths(void) for (j = 0; j < info->roms[i].num_memory; j++) { union string_list_elem_attr attr; - char path[PATH_MAX_LENGTH], ext[32]; + char path[PATH_MAX_LENGTH] = {0}; + char ext[32] = {0}; const struct retro_subsystem_memory_info *mem = (const struct retro_subsystem_memory_info*) &info->roms[i].memory[j];