Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-05-07 18:49:54 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-05-07 18:49:54 +0400
commit03039d4fc21d7fd37bf3552100f383bc0671c947 (patch)
tree88d878463752b66dc587b6b3bbc2b4da67eaff67 /winsup/cygwin/passwd.cc
parent951bc34df496e1f8fa31db778534ea3c86f71827 (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/cygwin/passwd.cc')
-rw-r--r--winsup/cygwin/passwd.cc4
1 files changed, 3 insertions, 1 deletions
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;
}