[Mesa-dev] [PATCH 3/3] mesa/main: check for null in invalid_array_element_syntax()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue May 5 03:50:59 PDT 2015


name string is coming through API call, need to be careful with it.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/main/program_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index b15a132..2891827 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -316,7 +316,7 @@ invalid_array_element_syntax(const GLchar *name)
    char *first = strchr(name, '[');
    char *last = strrchr(name, '[');
 
-   if (!first)
+   if (!first || !last)
       return false;
 
    /* No '+' or ' ' allowed anywhere. */
-- 
1.8.5.1



More information about the mesa-dev mailing list