about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-03 18:16:18 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-03 18:16:18 +0000
commit68536096c87890d8ebab1b9c9f0791cf9948e681 (patch)
tree3a57f6905bdf8ed1736dd27fd18d3e49ea74be99 /elf
parent4e9a34c48f7f1efcc0d050689ba2a94b6ea873b8 (diff)
downloadglibc-68536096c87890d8ebab1b9c9f0791cf9948e681.tar.gz
glibc-68536096c87890d8ebab1b9c9f0791cf9948e681.tar.xz
glibc-68536096c87890d8ebab1b9c9f0791cf9948e681.zip
Update.
	* elf/dl-load.c (expand_dynamic_string_token): Don't expand
	$ORIGIN for SUID binaries.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index d9645e6f54..c1d1d7eede 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -161,7 +161,9 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
     {
       size_t len = 1;
 
-      if (((strncmp (&sf[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
+      /* $ORIGIN is not expanded for SUID/GUID programs.  */
+      if (((!__libc_enable_secure
+	    && strncmp (&sf[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
 	   || (strncmp (&sf[1], "PLATFORM", 8) == 0 && (len = 9) != 0))
 	  && (s[len] == '\0' || s[len] == '/' || s[len] == ':'))
 	++cnt;
@@ -209,7 +211,8 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
 	  const char *repl;
 	  size_t len;
 
-	  if (((strncmp (&s[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
+	  if (((!__libc_enable_secure
+		&& strncmp (&s[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
 	       || (strncmp (&s[1], "PLATFORM", 8) == 0 && (len = 9) != 0))
 	      && (s[len] == '\0' || s[len] == '/' || s[len] == ':'))
 	    {