summaryrefslogtreecommitdiff
path: root/progs/glsl/shtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/glsl/shtest.c')
-rw-r--r--progs/glsl/shtest.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index 628a7dd5b9..7b1917be1c 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -492,9 +492,8 @@ ReadConfigFile(const char *filename, struct config_file *conf)
conf->num_uniforms = 0;
/* ugly but functional parser */
- while (!feof(f)) {
- fgets(line, sizeof(line), f);
- if (!feof(f) && line[0]) {
+ while (fgets(line, sizeof(line), f) != NULL) {
+ if (line[0]) {
if (strncmp(line, "vs ", 3) == 0) {
VertShaderFile = strdup(line + 3);
VertShaderFile[strlen(VertShaderFile) - 1] = 0;
@@ -550,6 +549,10 @@ ReadConfigFile(const char *filename, struct config_file *conf)
type = TypeFromName(typeName);
+ if (strlen(name) + 1 > sizeof(conf->uniforms[conf->num_uniforms].name)) {
+ fprintf(stderr, "string overflow\n");
+ exit(1);
+ }
strcpy(conf->uniforms[conf->num_uniforms].name, name);
conf->uniforms[conf->num_uniforms].value[0] = v1;
conf->uniforms[conf->num_uniforms].value[1] = v2;
@@ -627,7 +630,7 @@ Init(void)
NumAttribs = GetAttribs(Program, Attribs);
PrintAttribs(Attribs);
- //assert(glGetError() == 0);
+ /* assert(glGetError() == 0); */
glClearColor(0.4f, 0.4f, 0.8f, 0.0f);