Fix buffer overflow warnings in OpenGL 3.0 video display file handling

Patch from davefiddes. Original commit message :

This fixes issues reported by gcc 10 with the size of various filename buffers
when concatenating strings into them.

Tests:
 - Build cleanly with gcc 10
 - Run a Pentium MMX Win98 machine and use custom GLSLP shader
This commit is contained in:
SarahW 2020-07-14 19:42:20 +01:00
commit b5bc47ea2f
4 changed files with 5 additions and 5 deletions

View file

@ -163,9 +163,9 @@ void get_glslp_name(const char* f, char* s, int size)
glslp_t* glslp_parse(const char* f) glslp_t* glslp_parse(const char* f)
{ {
int i, j, len, sublen; int i, j, len, sublen;
char s[512], t[512], z[512]; char s[512], t[512], z[540];
s[511] = 0; memset(s, 0, sizeof(s));
if (endswith(f, ".glsl")) if (endswith(f, ".glsl"))
return glsl_parse(f); return glsl_parse(f);

View file

@ -22,7 +22,7 @@ struct texture {
}; };
struct shader { struct shader {
char shader_fn[512]; char shader_fn[1024];
char* shader_program; char* shader_program;
char alias[64]; char alias[64];
int filter_linear; int filter_linear;

View file

@ -559,7 +559,7 @@ static glsl_t* load_glslp(glsl_t* glsl, int num_shader, const char* f)
if (p) if (p)
{ {
char path[512]; char path[512];
char file[512]; char file[1024];
int failed = 0; int failed = 0;
strcpy(path, f); strcpy(path, f);
char* filename = get_filename(path); char* filename = get_filename(path);

View file

@ -504,7 +504,7 @@ int pc_main(int argc, char** argv)
paths_init(); paths_init();
#ifdef __linux__ #ifdef __linux__
char s[512]; char s[1024];
/* create directories if they don't exist */ /* create directories if they don't exist */
if (!wx_setup(pcem_path)) if (!wx_setup(pcem_path))
return FALSE; return FALSE;