projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5f2ea44
)
id bug fix: don't point to potentially clobbered static storage
author
Peter Fales
<psfales@alcatel-lucent.com>
Tue, 25 Mar 2008 21:44:01 +0000
(22:44 +0100)
committer
Jim Meyering
<meyering@redhat.com>
Tue, 25 Mar 2008 21:47:15 +0000
(22:47 +0100)
On at least Mac OS, when calling getpwuid twice with the same UID,
the static storage containing results from the first call is
invalidated by the second call.
* src/id.c (main): Point to a copy of the user name string.
src/id.c
patch
|
blob
|
history
diff --git
a/src/id.c
b/src/id.c
index 9ee52e1fcb1584c4c1cc003887d056d3df607798..a178714fd6ebb942bf0d7f0d1eb7be0f8573bffd 100644
(file)
--- a/
src/id.c
+++ b/
src/id.c
@@
-211,7
+211,7
@@
of a different user"));
struct passwd const *pwd;
euid = geteuid ();
pwd = getpwuid (euid);
- user_name = pwd ?
pwd->pw_name
: NULL;
+ user_name = pwd ?
xstrdup (pwd->pw_name)
: NULL;
ruid = getuid ();
egid = getegid ();
rgid = getgid ();