[newlib-cygwin/cygwin-acl] Avoid SEGV when handling SIDs with 0 subauthorities
Corinna Vinschen
corinna@sourceware.org
Thu Oct 22 15:39:00 GMT 2015
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=57f2c5983f785c63c7a29af0cfcc29f6b46e1315
commit 57f2c5983f785c63c7a29af0cfcc29f6b46e1315
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Thu Oct 22 15:38:42 2015 +0200
Avoid SEGV when handling SIDs with 0 subauthorities
* sec_helper.cc (cygsid::get_sid): Don't reject SIDs with missing
subauthorities.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/ChangeLog | 5 +++++
winsup/cygwin/release/2.3.0 | 3 +++
winsup/cygwin/sec_helper.cc | 5 ++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d3a47a4..0c7c5a9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2015-10-22 Corinna Vinschen <corinna@vinschen.de>
+ * sec_helper.cc (cygsid::get_sid): Don't reject SIDs with missing
+ subauthorities.
+
+2015-10-22 Corinna Vinschen <corinna@vinschen.de>
+
* strfuncs.cc (sys_cp_wcstombs): Always return number of multibytes
without trailing NUL as the documentation implies. Throughout Cygwin,
fix usage to align to this pattern.
diff --git a/winsup/cygwin/release/2.3.0 b/winsup/cygwin/release/2.3.0
index 99ef120..e3abb20 100644
--- a/winsup/cygwin/release/2.3.0
+++ b/winsup/cygwin/release/2.3.0
@@ -46,3 +46,6 @@ Bug Fixes
- Fix memory leak in calls to pthread_getattr_np.
- Fix output of /proc/<PID>/winexename.
+
+- Avoid SEGV when handling SIDs with 0 subauthorities.
+ Addresses: https://cygwin.com/ml/cygwin/2015-10/msg00141.html
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc
index 551face..af3307e 100644
--- a/winsup/cygwin/sec_helper.cc
+++ b/winsup/cygwin/sec_helper.cc
@@ -220,7 +220,10 @@ cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r, bool well_known)
SID_IDENTIFIER_AUTHORITY sid_auth = { SECURITY_NULL_SID_AUTHORITY };
# define SECURITY_NT_AUTH 5
- if (s > 255 || cnt < 1 || cnt > SID_MAX_SUB_AUTHORITIES)
+ /* 2015-10-22: Note that we let slip SIDs with a subauthority count of 0.
+ There are systems, which generate the SID S-1-0 as group ownership SID,
+ see https://cygwin.com/ml/cygwin/2015-10/msg00141.html. */
+ if (s > 255 || cnt > SID_MAX_SUB_AUTHORITIES)
{
psid = NO_SID;
return NULL;
More information about the Cygwin-cvs
mailing list