about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-26 12:12:28 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-26 12:12:28 +0000
commitc4e328a12e1ddbdf9c5dbede56beb826d50f2776 (patch)
treeac7676f5cba094e30790ad7ab563c77f61162dbe
parent412c954afacf0e5f62ff66ae870df18444b4a799 (diff)
downloadglibc-c4e328a12e1ddbdf9c5dbede56beb826d50f2776.tar.gz
glibc-c4e328a12e1ddbdf9c5dbede56beb826d50f2776.tar.xz
glibc-c4e328a12e1ddbdf9c5dbede56beb826d50f2776.zip
[BZ #384]
Update.
	* elf/dl-support.c (_dl_non_dynamic_init): Fix cleaning of
	environment.  [BZ #384]
-rw-r--r--ChangeLog3
-rw-r--r--elf/dl-support.c20
2 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f80b6c97a..5a923c9b5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-09-26  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-support.c (_dl_non_dynamic_init): Fix cleaning of
+	environment.  [BZ #384]
+
 	* sunrpc/clnt_udp.c (is_network_up): Use getifaddrs instead of ioctl.
 	* sunrpc/get_myaddr.c (get_myaddress): Likewise.
 	* sunrpc/pmap_clnt.c (__get_myaddress): Likewise.
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 2b53770605..c5976cd401 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -257,22 +257,22 @@ _dl_non_dynamic_init (void)
 
   if (__libc_enable_secure)
     {
-      static const char *unsecure_envvars[] =
-      {
-	UNSECURE_ENVVARS,
+      static const char unsecure_envvars[] =
+	UNSECURE_ENVVARS
 #ifdef EXTRA_UNSECURE_ENVVARS
 	EXTRA_UNSECURE_ENVVARS
 #endif
-      };
-      size_t cnt;
+	;
+      const char *cp = unsecure_envvars;
 
-      for (cnt = 0;
-	   cnt < sizeof (unsecure_envvars) / sizeof (unsecure_envvars[0]);
-	   ++cnt)
-	unsetenv (unsecure_envvars[cnt]);
+      while (cp < unsecure_envvars + sizeof (unsecure_envvars))
+	{
+	  __unsetenv (cp);
+	  cp = (const char *) __rawmemchr (cp, '\0') + 1;
+	}
 
       if (__access ("/etc/suid-debug", F_OK) != 0)
-	unsetenv ("MALLOC_CHECK_");
+	__unsetenv ("MALLOC_CHECK_");
     }
 
 #ifdef DL_PLATFORM_INIT