[COMMITTED] elf: Fix a wrong array access on tst-tls20

Message ID 20210716113445.2231396-1-adhemerval.zanella@linaro.org
State Committed
Commit 881b68e45c3a518319dcf5a3c4a2b3ec59e1c1e5
Headers
Series [COMMITTED] elf: Fix a wrong array access on tst-tls20 |

Commit Message

Adhemerval Zanella July 16, 2021, 11:34 a.m. UTC
  Check on x86_64-linux-gnu with --enable-stack-protector=all.
---
 elf/tst-tls20.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/elf/tst-tls20.c b/elf/tst-tls20.c
index d8d04fe574..831c3336c9 100644
--- a/elf/tst-tls20.c
+++ b/elf/tst-tls20.c
@@ -226,12 +226,12 @@  do_test_dependency (void)
       int mods[nmods];
       /* We use '0' as indication for a gap, to avoid the dlclose on iteration
 	 cleanup.  */
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
 	{
 	  load_mod (n);
 	   mods[n] = n;
 	}
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
 	{
 	  if (!is_mod_set (g, n))
 	    {
@@ -304,12 +304,12 @@  do_test_invalid_dependency (bool bind_now)
       int mods[nmods];
       /* We use '0' as indication for a gap, to avoid the dlclose on iteration
 	 cleanup.  */
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
 	{
 	  load_mod (n);
 	   mods[n] = n;
 	}
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
 	{
 	  if (!is_mod_set (g, n))
 	    {