Fix crash reading invalid SIDs from passwd and group files
* grp.cc (pwdgrp::parse_group): Only copy the SID if it's valid. * passwd.cc (pwdgrp::parse_passwd): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
4fbb2eb2c0
commit
c7432b13fa
|
@ -1,3 +1,8 @@
|
|||
2015-12-16 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* grp.cc (pwdgrp::parse_group): Only copy the SID if it's valid.
|
||||
* passwd.cc (pwdgrp::parse_passwd): Ditto.
|
||||
|
||||
2015-12-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* include/cygwin/signal.h (sigset_t): Move defintition to newlib.
|
||||
|
|
|
@ -48,8 +48,8 @@ pwdgrp::parse_group ()
|
|||
/* Don't generate gr_mem entries. */
|
||||
grp.g.gr_mem = &null_ptr;
|
||||
cygsid csid;
|
||||
csid.getfromgr_passwd (&grp.g);
|
||||
RtlCopySid (SECURITY_MAX_SID_SIZE, grp.sid, csid);
|
||||
if (csid.getfromgr_passwd (&grp.g))
|
||||
RtlCopySid (SECURITY_MAX_SID_SIZE, grp.sid, csid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ pwdgrp::parse_passwd ()
|
|||
res.p.pw_dir = next_str (':');
|
||||
res.p.pw_shell = next_str (':');
|
||||
cygsid csid;
|
||||
csid.getfrompw_gecos (&res.p);
|
||||
RtlCopySid (SECURITY_MAX_SID_SIZE, res.sid, csid);
|
||||
if (csid.getfrompw_gecos (&res.p))
|
||||
RtlCopySid (SECURITY_MAX_SID_SIZE, res.sid, csid);
|
||||
/* 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;
|
||||
|
|
Loading…
Reference in New Issue