diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-05-07 18:49:54 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-05-07 18:49:54 +0400 |
commit | 03039d4fc21d7fd37bf3552100f383bc0671c947 (patch) | |
tree | 88d878463752b66dc587b6b3bbc2b4da67eaff67 /winsup | |
parent | 951bc34df496e1f8fa31db778534ea3c86f71827 (diff) |
* passwd.cc (pwdgrp::parse_passwd): Fix an off by one computing the
buffer len. Add comment.
* uinfo.cc (internal_getlogin): Fix typo in comment.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/passwd.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/uinfo.cc | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a9c3f9f02..21608730e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2014-05-07 Corinna Vinschen <corinna@vinschen.de> + * passwd.cc (pwdgrp::parse_passwd): Fix an off by one computing the + buffer len. Add comment. + * uinfo.cc (internal_getlogin): Fix typo in comment. + +2014-05-07 Corinna Vinschen <corinna@vinschen.de> + * uinfo.cc (pwdgrp::fetch_account_from_windows): Tweak SID<->uid conversion to cover S-1-5-113, S-1-5-114, and S-1-5-1000 groups. diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 9a7c91863..4482ce124 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -41,7 +41,9 @@ pwdgrp::parse_passwd () res.p.pw_dir = next_str (':'); res.p.pw_shell = next_str (':'); res.sid.getfrompw (&res.p); - res.len = lptr - res.p.pw_name; + /* lptr points to the \0 after pw_shell. Increment by one to get the correct + required buffer len in getpw_cp. */ + res.len = lptr - res.p.pw_name + 1; return true; } diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 5d69f4236..221eabfb2 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -135,7 +135,7 @@ internal_getlogin (cygheap_user &user) user.set_name (pwd->pw_name); myself->uid = pwd->pw_uid; myself->gid = pwd->pw_gid; - /* Is the primary group in the passwd DB is different from the primary + /* If the primary group in the passwd DB is different from the primary group in the user token, we have to find the SID of that group and try to override the token primary group. */ if (!pgrp || myself->gid != pgrp->gr_gid) |