diff options
author | Ian Romanick <[email protected]> | 2016-05-24 10:10:40 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-06-02 13:33:53 +0100 |
commit | 1398a9510f31a42008385d9b2c0bac4dde60f529 (patch) | |
tree | f3dd2c5c858d3bd2a61b9b705d5c61cf8f7c3a49 /src/mesa | |
parent | b265796c79b6fda7cdd3fa4e3876a460434e4153 (diff) |
mesa: Fix bogus strncmp
The string "[0]\0" is the same as "[0]" as far as the C string datatype
is concerned. That string has length 3. strncmp(s, length_3_string, 4)
is the same as strcmp(s, length_3_string), so make it be strcmp.
v2: Not the same as strncmp(..., 3). Noticed by Ilia.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Cc: "12.0" <[email protected]>
(cherry picked from commit 049bb94d2e177f7415e7dddd71907be3e7f153c6)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/shader_query.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 28d8147efe0..eec933c2176 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -505,7 +505,7 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg, if (rname_last_square_bracket) { baselen_without_array_index -= strlen(rname_last_square_bracket); rname_has_array_index_zero = - (strncmp(rname_last_square_bracket, "[0]\0", 4) == 0) && + (strcmp(rname_last_square_bracket, "[0]") == 0) && (baselen_without_array_index == strlen(name)); } |