From 10a1154b0624bcfb58d58d7303607ce1ecd7842a Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Tue, 24 Sep 2024 20:24:46 -0400 Subject: [PATCH] Avoid calling strlcpy when copying string onto itself (#17031) --- gfx/video_shader_parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index d6dbb5431d..bdacbe25ef 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -3033,8 +3033,9 @@ bool video_shader_apply_shader( configuration_set_bool(settings, settings->bools.video_shader_enable, true); if (!string_is_empty(preset_path)) { - strlcpy(runloop_st->runtime_shader_preset_path, preset_path, - sizeof(runloop_st->runtime_shader_preset_path)); + if (runloop_st->runtime_shader_preset_path != preset_path) + strlcpy(runloop_st->runtime_shader_preset_path, preset_path, + sizeof(runloop_st->runtime_shader_preset_path)); #ifdef HAVE_MENU /* reflect in shader manager */ if (menu_shader_manager_set_preset(