diff --git a/src/opengl_utils.c b/src/opengl_utils.c index 2f14a5ee3e..e9497f3584 100644 --- a/src/opengl_utils.c +++ b/src/opengl_utils.c @@ -196,8 +196,8 @@ void oglu_init() if (glversion) { strncpy(g_oglu_version, glversion, sizeof(g_oglu_version) - 1); - const char deli[2] = " "; - strtok(g_oglu_version, deli); + g_oglu_version[sizeof(g_oglu_version) - 1] = '\0'; /* strncpy fix */ + strtok(g_oglu_version, " "); } else { diff --git a/src/render_ogl.c b/src/render_ogl.c index 428453e617..f208ab66f2 100644 --- a/src/render_ogl.c +++ b/src/render_ogl.c @@ -157,6 +157,7 @@ static void ogl_build_programs() char shader_path[MAX_PATH] = { 0 }; strncpy(shader_path, g_config.shader, sizeof(shader_path)); + shader_path[sizeof(shader_path) - 1] = '\0'; /* strncpy fix */ if (GetFileAttributes(shader_path) == INVALID_FILE_ATTRIBUTES) { @@ -530,7 +531,7 @@ static void ogl_init_scale_program() glBindVertexArray(0); - float input_size[2], output_size[2], texture_size[2]; + float input_size[2] = { 0 }, output_size[2] = { 0 }, texture_size[2] = { 0 }; input_size[0] = (float)g_ddraw.width; input_size[1] = (float)g_ddraw.height;