Avoid potential crash at startup or in getgroups(2).
* grp.cc (internal_getgroups): Handle negative domain index to avoid crashes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2015-04-01  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* grp.cc (internal_getgroups): Handle negative domain index to avoid | ||||||
|  | 	crashes. | ||||||
|  |  | ||||||
| 2015-03-31  Renato Silva  <br.renatosilva@gmail.com> | 2015-03-31  Renato Silva  <br.renatosilva@gmail.com> | ||||||
|  |  | ||||||
| 	* net.cc (cygwin_gethostname): Fix buffer size error handling. | 	* net.cc (cygwin_gethostname): Fix buffer size error handling. | ||||||
|   | |||||||
| @@ -643,13 +643,17 @@ internal_getgroups (int gidsetsize, gid_t *grouplist, cyg_ldap *pldap) | |||||||
| 	{ | 	{ | ||||||
| 	  for (ULONG ncnt = 0; ncnt < scnt; ++ncnt) | 	  for (ULONG ncnt = 0; ncnt < scnt; ++ncnt) | ||||||
| 	    { | 	    { | ||||||
|  | 	      static UNICODE_STRING empty = { 0, 0, (PWSTR) L"" }; | ||||||
| 	      fetch_acc_t full_acc = | 	      fetch_acc_t full_acc = | ||||||
| 		{ | 		{ | ||||||
| 		  .sid = sidp_buf[ncnt], | 		  .sid = sidp_buf[ncnt], | ||||||
| 		  .name = &nlst[ncnt].Name, | 		  .name = &nlst[ncnt].Name, | ||||||
| 		  .dom = &dlst->Domains[nlst[ncnt].DomainIndex].Name, | 		  .dom = &empty, | ||||||
| 		  .acc_type = nlst[ncnt].Use | 		  .acc_type = nlst[ncnt].Use | ||||||
| 		}; | 		}; | ||||||
|  |  | ||||||
|  | 	      if (nlst[ncnt].DomainIndex >= 0) | ||||||
|  | 	        full_acc.dom = &dlst->Domains[nlst[ncnt].DomainIndex].Name; | ||||||
| 	      if ((grp = internal_getgrfull (full_acc, pldap))) | 	      if ((grp = internal_getgrfull (full_acc, pldap))) | ||||||
| 		{ | 		{ | ||||||
| 		  if (cnt < gidsetsize) | 		  if (cnt < gidsetsize) | ||||||
|   | |||||||
| @@ -32,3 +32,6 @@ Bug Fixes | |||||||
| - Avoid creating passwd and group records from fully qualified Windows | - Avoid creating passwd and group records from fully qualified Windows | ||||||
|   account names (domain\name, name@domain). |   account names (domain\name, name@domain). | ||||||
|   Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00528.html |   Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00528.html | ||||||
|  |  | ||||||
|  | - Avoid potential crash at startup or in getgroups(2). | ||||||
|  |   Addresses: https://cygwin.com/ml/cygwin/2015-04/msg00010.html | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user