summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-01-27 17:00:17 +0000
committerChristopher Faylor <me@cgf.cx>2003-01-27 17:00:17 +0000
commitdfb366da5a1b4af2f016ef6ce94d9cee02e74522 (patch)
treee7907be89998bbe85298d96d1c5e646cbe47741c
parentca6018a0d3504a5e3678542a27f5ce5b086f4b72 (diff)
downloadcygnal-dfb366da5a1b4af2f016ef6ce94d9cee02e74522.tar.gz
cygnal-dfb366da5a1b4af2f016ef6ce94d9cee02e74522.tar.bz2
cygnal-dfb366da5a1b4af2f016ef6ce94d9cee02e74522.zip
* passwd.cc (pwdgrp::parse_passwd): Be more unforgiving about non-numeric
fields.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/passwd.cc9
2 files changed, 9 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 96574200c..a7464a14c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2003-01-27 Christopher Faylor <cgf@redhat.com>
+
+ * passwd.cc (pwdgrp::parse_passwd): Be more unforgiving about
+ non-numeric fields.
+
2003-01-26 Christopher Faylor <cgf@redhat.com>
* uinfo.cc (pwdgrp::next_num): Remove check for NULL since it is no
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index c257bd640..ee1239227 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -40,11 +40,10 @@ pwdgrp::parse_passwd ()
# define res (*passwd_buf)[curr_lines]
res.pw_name = next_str (':');
res.pw_passwd = next_str (':');
- char *p = raw_ptr ();
- (void) next_num (res.pw_uid);
- if (p == raw_ptr ())
- return false; /* parsing did not advance. line is garbage */
- (void) next_num (res.pw_gid);
+ if (!next_num (res.pw_uid))
+ return false;
+ if (!next_num (res.pw_gid))
+ return false;
res.pw_comment = NULL;
res.pw_gecos = next_str (':');
res.pw_dir = next_str (':');