On Tuesday, May 05, 2015 01:50:59 PM Juha-Pekka Heikkila wrote: > name string is coming through API call, need to be careful with it. > > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@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. */ >
This patch is unnecessary - first and last will either both be NULL, or both be non-NULL. You're searching for the same character ('[') in a string forwards, then backwards. If it doesn't appear, both will be NULL. If it does appear, both calls will find an occurance of that character (possibly different).
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev