]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix off-by-one OOB read in elf/tst-tls20
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 11 Oct 2022 12:07:59 +0000 (13:07 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 28 Oct 2022 10:16:51 +0000 (11:16 +0100)
The int mods[nmods] array on the stack was overread by one.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
elf/tst-tls20.c

index ce4635eeb1af1dcf00241c2d0969369a947eabf4..9cebe22a402e9c9d2c85384521c5e5ba52405816 100644 (file)
@@ -264,7 +264,7 @@ do_test_dependency (void)
          xdlclose (moddep);
        }
 
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
        if (mods[n] != 0)
          unload_mod (n);
     }
@@ -342,7 +342,7 @@ do_test_invalid_dependency (bool bind_now)
            xdlclose (moddep);
        }
 
-      for (int n = 1; n <= nmods; n++)
+      for (int n = 1; n < nmods; n++)
        if (mods[n] != 0)
          unload_mod (n);
     }