summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2005-07-07 18:10:33 +0000
committerdelphij <delphij@FreeBSD.org>2005-07-07 18:10:33 +0000
commit909e7ff886fb519c878c02fa47955048637cc7e7 (patch)
treed1921c58b11cdd67c4a5488beb4909dbd89df2ee /bin
parent979be5a2e14d0620c8c3f9349fa59057243ab738 (diff)
downloadFreeBSD-src-909e7ff886fb519c878c02fa47955048637cc7e7.zip
FreeBSD-src-909e7ff886fb519c878c02fa47955048637cc7e7.tar.gz
Fix a bug when shell expansion is done against dangling symlinks, by
converting the stat() call to a lstat() call, which will cover the situation. One can exercise this bug by referring a dangling link with something like */the-link. Approved by: re (scottl) Submitted by: Simon 'corecode' Schubert [corecode fs ei tum de] Obtained from: NetBSD via DragonFlyBSD (NetBSD rev. 1.51 and DragonFly rev. 1.6) MFC After: 3 days
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/expand.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index eccefd0..f087f54 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -1162,7 +1162,7 @@ expmeta(char *enddir, char *name)
if (*p == '\0')
break;
}
- if (metaflag == 0 || stat(expdir, &statb) >= 0)
+ if (metaflag == 0 || lstat(expdir, &statb) >= 0)
addfname(expdir);
return;
}
OpenPOWER on IntegriCloud