aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-10-22 15:38:42 +0200
committerCorinna Vinschen <corinna@vinschen.de>2015-10-22 15:38:42 +0200
commite01381afde33020522fe692e0a1a791c99b6f049 (patch)
tree77427be065893b0401a143d86e8ed0882bf7323b /winsup
parent6599fad55dfa08882ff07f11132e772af5f152b3 (diff)
downloadnewlib-e01381afde33020522fe692e0a1a791c99b6f049.zip
newlib-e01381afde33020522fe692e0a1a791c99b6f049.tar.gz
newlib-e01381afde33020522fe692e0a1a791c99b6f049.tar.bz2
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>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/release/2.3.03
-rw-r--r--winsup/cygwin/sec_helper.cc5
3 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7cd19b5..f09c3d7 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 f505040..1fc92d2 100644
--- a/winsup/cygwin/release/2.3.0
+++ b/winsup/cygwin/release/2.3.0
@@ -43,3 +43,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 0c3a51c..8067385 100644
--- a/winsup/cygwin/sec_helper.cc
+++ b/winsup/cygwin/sec_helper.cc
@@ -218,7 +218,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;