public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix dl-environ.c
@ 2002-09-11 14:54 Jakub Jelinek
  2002-09-11 15:04 ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2002-09-11 14:54 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

ld.so has apparently been too aggressive when removing variables
from environment, particularly it removed all the unsecure envvars (as
it should) plus all its prefixes, ie. it removed
LOCALDOMAIN, but e.g. LOCALDOMAI, LOCAL, LOCA, LO or L variables too.

2002-09-11  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/generic/dl-environ.c (unsetenv): Only remove variables fully
	matching name.

--- libc/sysdeps/generic/dl-environ.c.jj	2002-03-23 11:51:04.000000000 +0100
+++ libc/sysdeps/generic/dl-environ.c	2002-09-11 22:53:42.000000000 +0200
@@ -67,7 +67,7 @@ unsetenv (const char *name)
       while ((*ep)[cnt] == name[cnt] && name[cnt] != '\0')
 	++cnt;
 
-      if ((*ep)[cnt] == '=')
+      if ((*ep)[cnt] == '=' && name[cnt] == '\0')
 	{
 	  /* Found it.  Remove this pointer by moving later ones to
 	     the front.  */

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix dl-environ.c
  2002-09-11 14:54 [PATCH] Fix dl-environ.c Jakub Jelinek
@ 2002-09-11 15:04 ` Roland McGrath
  2002-09-11 15:10   ` Ulrich Drepper
  0 siblings, 1 reply; 3+ messages in thread
From: Roland McGrath @ 2002-09-11 15:04 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

D'oh!  I don't see why that should be avoiding normal string routines,
so I instead just snarfed the loop from the vanilla unsetenv, which
does the same but using strncmp.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix dl-environ.c
  2002-09-11 15:04 ` Roland McGrath
@ 2002-09-11 15:10   ` Ulrich Drepper
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Drepper @ 2002-09-11 15:10 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Jakub Jelinek, Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roland McGrath wrote:
> D'oh!  I don't see why that should be avoiding normal string routines,
> so I instead just snarfed the loop from the vanilla unsetenv, which
> does the same but using strncmp.

The reason it is not using srncmp is that this is the only use of 
strncmp in ld.so and it's not time-critical.  For a simple-minded inline 
function is better.

- -- 
- ---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9f79i2ijCOnn/RHQRAkNSAJ913GpulPx7seOjnVyMK5nwqAZ7zgCfV6aq
wvhiwAbIwsMEAIQpzO0Qaxo=
=e9I+
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-11 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-11 14:54 [PATCH] Fix dl-environ.c Jakub Jelinek
2002-09-11 15:04 ` Roland McGrath
2002-09-11 15:10   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).