diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b89f37467..c63871cfd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,9 @@ -2014-05-20 Corinna Vinschen +2014-05-22 Corinna Vinschen + + * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix potential SEGV + referencing NULL pointer. + +2014-05-22 Corinna Vinschen * libc/bsdlib.cc (forkpty): Close master and slave if fork fails to avoid resource leak (CID 59997). diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 8f8f78cbc..409d0edbd 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -1441,17 +1441,17 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) else { /* Some trusted domain? */ - PDS_DOMAIN_TRUSTSW td = NULL; + PDS_DOMAIN_TRUSTSW td = NULL, this_td = NULL; for (ULONG idx = 0; (td = cygheap->dom.trusted_domain (idx)); ++idx) { fetch_posix_offset (td, cldap); if (td->PosixOffset > posix_offset && td->PosixOffset <= arg.id) - posix_offset = td->PosixOffset; + posix_offset = (this_td = td)->PosixOffset; } - if (posix_offset) + if (this_td) { - cygpsid tsid (td->DomainSid); + cygpsid tsid (this_td->DomainSid); PWCHAR s = tsid.pstring (sidstr); __small_swprintf (s, L"-%u", arg.id - posix_offset); }