about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-04 01:48:08 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-04 01:48:08 +0000
commit27aa0631c73ee805519f3ac078eaef460f1b4bc3 (patch)
treec269967b8d5031b224f88688237271d28d4b26d3 /elf/dl-load.c
parent9f509acb28ecbebb1bf25069fd60219bc85971ac (diff)
downloadglibc-27aa0631c73ee805519f3ac078eaef460f1b4bc3.tar.gz
glibc-27aa0631c73ee805519f3ac078eaef460f1b4bc3.tar.xz
glibc-27aa0631c73ee805519f3ac078eaef460f1b4bc3.zip
Update.
1999-05-04  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-load.c (expand_dynamic_string_token): Recognize { }
	around DST.  Correctly ignore ORIGIN IN SUID binaries.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 05569edc9c..bdae4ba1da 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -171,10 +171,15 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
       size_t len = 1;
 
       /* $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] == ':'))
+      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] == ':'))
+	  || (s[1] == '{'
+	      && ((!__libc_enable_secure
+		   && strncmp (&sf[2], "ORIGIN}", 7) == 0 && (len = 9) != 0)
+		  || (strncmp (&sf[2], "PLATFORM}", 9) == 0
+		      && (len = 11) != 0))))
 	++cnt;
 
       st = sf + len;
@@ -220,13 +225,19 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
 	  const char *repl;
 	  size_t len;
 
-	  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] == ':'))
+	  if ((((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] == ':'))
+	      || (s[1] == '{'
+		  && ((strncmp (&s[2], "ORIGIN}", 7) == 0 && (len = 9) != 0)
+		      || (strncmp (&s[2], "PLATFORM}", 9) == 0
+			  && (len = 11) != 0))))
 	    {
-	      if ((repl = len == 7 ? l->l_origin : _dl_platform) != NULL
-		  && repl != (const char *) -1)
+	      repl = ((len == 7 || s[2] == 'O')
+		      ? (__libc_enable_secure ? NULL : l->l_origin)
+		      : _dl_platform);
+
+	      if (repl != NULL && repl != (const char *) -1)
 		{
 		  wp = __stpcpy (wp, repl);
 		  s += len;
@@ -242,7 +253,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
 		}
 	    }
 	  else
-	    /* No SDK we recognize.  */
+	    /* No DST we recognize.  */
 	    *wp++ = *s++;
 	}
       else if (*s == ':')