From 49e8baa61d8aa5bba494bce1e6bab609db73da48 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 25 Jun 2016 07:17:48 +0200 Subject: [PATCH] Use tmp_str variable for config_get_path usage --- gfx/video_shader_parse.c | 11 +++++++---- tasks/task_overlay.c | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index 784f86f5ef..b74f82aa0e 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -133,17 +133,19 @@ static bool video_shader_parse_pass(config_file_t *conf, char frame_count_mod[64] = {0}; struct gfx_fbo_scale *scale = NULL; bool tmp_bool = false; + char tmp_str[PATH_MAX_LENGTH]= {0}; float fattr = 0.0f; int iattr = 0; /* Source */ snprintf(shader_name, sizeof(shader_name), "shader%u", i); - if (!config_get_path(conf, shader_name, - pass->source.path, sizeof(pass->source.path))) + if (!config_get_path(conf, shader_name, tmp_str, sizeof(tmp_str))) { RARCH_ERR("Couldn't parse shader source (%s).\n", shader_name); return false; } + + strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path)); /* Smooth */ snprintf(filter_name_buf, sizeof(filter_name_buf), "filter_linear%u", i); @@ -492,6 +494,7 @@ static bool video_shader_parse_imports(config_file_t *conf, const char *id = NULL; char *save = NULL; char imports[1024] = {0}; + char tmp_str[PATH_MAX_LENGTH]= {0}; if (!config_get_array(conf, "imports", imports, sizeof(imports))) return true; @@ -594,8 +597,8 @@ static bool video_shader_parse_imports(config_file_t *conf, var->equal = equal; } - config_get_path(conf, "import_script", - shader->script_path, sizeof(shader->script_path)); + if (config_get_path(conf, "import_script", tmp_str, sizeof(tmp_str))) + strlcpy(shader->script_path, tmp_str, sizeof(shader->script_path)); config_get_array(conf, "import_script_class", shader->script_class, sizeof(shader->script_class)); diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index 697c6daeab..c7744e1941 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -391,6 +391,7 @@ static void task_overlay_deferred_load(retro_task_t *task) struct texture_image *texture_img = NULL; struct overlay_desc *overlay_desc = NULL; struct overlay *overlay = NULL; + char tmp_str[PATH_MAX_LENGTH] = {0}; bool to_cont = loader->pos < loader->size; if (!to_cont) @@ -463,8 +464,10 @@ static void task_overlay_deferred_load(retro_task_t *task) snprintf(overlay->config.paths.key, sizeof(overlay->config.paths.key), "overlay%u_overlay", loader->pos); - config_get_path(conf, overlay->config.paths.key, - overlay->config.paths.path, sizeof(overlay->config.paths.path)); + if (config_get_path(conf, overlay->config.paths.key, + tmp_str, sizeof(tmp_str))) + strlcpy(overlay->config.paths.path, + tmp_str, sizeof(overlay->config.paths.path)); if (!string_is_empty(overlay->config.paths.path)) {