elf: Fix a wrong array access on tst-tls20
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 16 Jul 2021 11:32:05 +0000 (08:32 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 16 Jul 2021 11:32:37 +0000 (08:32 -0300)
Check on x86_64-linux-gnu with --enable-stack-protector=all.

elf/tst-tls20.c

index d8d04fe..831c333 100644 (file)
@@ -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))
            {