Mesa (mesa_7_7_branch): progs/glsl: Prevent possible string overflow.

Vinson Lee vlee at kemper.freedesktop.org
Wed Jan 6 23:26:45 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: c1dad22d7159569b978fdfcb87e4a718041b7d07
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1dad22d7159569b978fdfcb87e4a718041b7d07

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Jan  6 15:25:42 2010 -0800

progs/glsl: Prevent possible string overflow.

---

 progs/glsl/shtest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index e9800c3..7b1917b 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -549,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;




More information about the mesa-commit mailing list