about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-10-11 13:07:59 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-10-28 11:16:51 +0100
commit6a3794ea917558776ba1a66a925f2d5e1dbf0724 (patch)
treec7124c1f2eeaed38eabd1de304dcf5015eb0caad /elf
parenteef17d4d9fcd38c5cbb9bc9515ba72d1773b67a2 (diff)
downloadglibc-6a3794ea917558776ba1a66a925f2d5e1dbf0724.tar.gz
glibc-6a3794ea917558776ba1a66a925f2d5e1dbf0724.tar.xz
glibc-6a3794ea917558776ba1a66a925f2d5e1dbf0724.zip
Fix off-by-one OOB read in elf/tst-tls20
The int mods[nmods] array on the stack was overread by one.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'elf')
-rw-r--r--elf/tst-tls20.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/elf/tst-tls20.c b/elf/tst-tls20.c
index ce4635eeb1..9cebe22a40 100644
--- a/elf/tst-tls20.c
+++ b/elf/tst-tls20.c
@@ -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);
     }