From: Vinson Lee Date: Wed, 6 Jan 2010 23:25:42 +0000 (-0800) Subject: progs/glsl: Prevent possible string overflow. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1dad22d7159569b978fdfcb87e4a718041b7d07;p=mesa.git progs/glsl: Prevent possible string overflow. --- diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index e9800c307f3..7b1917be1ce 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;