summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorab196087 <none@none>2006-01-05 12:20:33 -0800
committerab196087 <none@none>2006-01-05 12:20:33 -0800
commita73372d3d41ae7d1d36925fb4887777c85070013 (patch)
tree0da8640b3e7d81423381aca5c7a45162d3f84220 /usr/src
parentdab0f6911a91ef098e7d5b0c39fef0a8741d41b3 (diff)
downloadillumos-gate-a73372d3d41ae7d1d36925fb4887777c85070013.tar.gz
6326497 ld.so not properly processing LD_LIBRARY_PATH ending in :
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README3
-rw-r--r--usr/src/cmd/sgs/rtld/common/paths.c29
2 files changed, 26 insertions, 6 deletions
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index fca1ac635f..6f47d5c8bf 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -1,6 +1,6 @@
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# CDDL HEADER START
@@ -1081,3 +1081,4 @@ Bugid Risk Synopsis
6362047 ld.so.1 dumps core when combining HWCAP and LD_PROFILE
6304206 runtime linker may respect LANG and LC_MESSAGE more than LC_ALL
6363495 Catchup required with Intel relocations
+6326497 ld.so not properly processing LD_LIBRARY_PATH ending in :
diff --git a/usr/src/cmd/sgs/rtld/common/paths.c b/usr/src/cmd/sgs/rtld/common/paths.c
index f9de3e2ca9..b384998eca 100644
--- a/usr/src/cmd/sgs/rtld/common/paths.c
+++ b/usr/src/cmd/sgs/rtld/common/paths.c
@@ -24,7 +24,7 @@
* Copyright (c) 1988 AT&T
* All Rights Reserved
*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -822,21 +822,37 @@ expand_paths(Rt_map * clmp, const char *list, uint_t orig, uint_t omit)
{
char *str, *olist = 0, *nlist = (char *)list;
Pnode *pnp, *npnp, *opnp;
+ int fnull = FALSE; /* TRUE if empty final path segment seen */
- for (pnp = opnp = 0, str = nlist; *nlist; str = nlist) {
+ for (pnp = opnp = 0, str = nlist; *nlist || fnull; str = nlist) {
char *ostr;
size_t len, olen;
uint_t tkns = 0;
if (*nlist == ';')
++nlist, ++str;
- if (*nlist == ':') {
+ if ((*nlist == ':') || fnull) {
+ /* If not a final null segment, check following one */
+ fnull = !(fnull || *(nlist + 1));
+
+ if (*nlist)
+ nlist++;
+
+ /*
+ * When the shell sees a null PATH segment, it
+ * treats it as if it were the cwd (.). We mimic
+ * this behavior for LD_LIBRARY_PATH and runpaths
+ * (mainly for backwards compatibility with previous
+ * behavior). For other paths, this makes no sense,
+ * so we simply ignore the segment.
+ */
+ if (!(orig & (LA_SER_LIBPATH | LA_SER_RUNPATH)))
+ continue; /* Process next segment */
+
if ((str = strdup(MSG_ORIG(MSG_FMT_CWD))) == NULL)
return ((Pnode *)0);
len = MSG_FMT_CWD_SIZE;
- if (*nlist)
- nlist++;
} else {
char *elist;
@@ -845,6 +861,9 @@ expand_paths(Rt_map * clmp, const char *list, uint_t orig, uint_t omit)
nlist++, len++;
}
+ /* Check for a following final null segment */
+ fnull = (*nlist == ':') && !*(nlist + 1);
+
if (*nlist)
nlist++;