]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
rtld: properly handle root directory in load path (bug 30435)
authorAndreas Schwab <schwab@suse.de>
Tue, 16 May 2023 12:41:46 +0000 (14:41 +0200)
committerAndreas Schwab <schwab@suse.de>
Thu, 25 May 2023 09:47:12 +0000 (11:47 +0200)
Don't strip the trailing slash when checking for existence of a load path
element to handle the special case of the root directory.

elf/dl-load.c

index 39c63ff1b36e37ff453af3338a8d9b550af30ebd..2aa487b49ac6267540dbdeed88d989008b562eeb 100644 (file)
@@ -1859,7 +1859,7 @@ open_path (const char *name, size_t namelen, int mode,
                     test whether there is any directory at all.  */
                  struct __stat64_t64 st;
 
-                 buf[buflen - namelen - 1] = '\0';
+                 buf[buflen - namelen] = '\0';
 
                  if (__stat64_time64 (buf, &st) != 0
                      || ! S_ISDIR (st.st_mode))