public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: get_posix_access: avoid negative subscript
@ 2019-08-28 12:31 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2019-08-28 12:31 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=398476acd2dca8d68044e1b6e68eb41a16086f79

commit 398476acd2dca8d68044e1b6e68eb41a16086f79
Author: Ken Brown <kbrown@cornell.edu>
Date:   Mon Aug 26 13:38:31 2019 -0400

    Cygwin: get_posix_access: avoid negative subscript
    
    Don't refer to lacl[pos] unless we know that pos >= 0.

Diff:
---
 winsup/cygwin/sec_acl.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index 933bfa6..67749d7 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -807,9 +807,9 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
 			  lacl[pos].a_id = ACL_UNDEFINED_ID;
 			  lacl[pos].a_perm = CYG_ACE_MASK_TO_POSIX (ace->Mask);
 			  aclsid[pos] = well_known_null_sid;
+			  has_class_perm = true;
+			  class_perm = lacl[pos].a_perm;
 			}
-		      has_class_perm = true;
-		      class_perm = lacl[pos].a_perm;
 		    }
 		  if (ace->Header.AceFlags & SUB_CONTAINERS_AND_OBJECTS_INHERIT)
 		    {
@@ -820,9 +820,9 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
 			  lacl[pos].a_id = ACL_UNDEFINED_ID;
 			  lacl[pos].a_perm = CYG_ACE_MASK_TO_POSIX (ace->Mask);
 			  aclsid[pos] = well_known_null_sid;
+			  has_def_class_perm = true;
+			  def_class_perm = lacl[pos].a_perm;
 			}
-		      has_def_class_perm = true;
-		      def_class_perm = lacl[pos].a_perm;
 		    }
 		}
 	    }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-28 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 12:31 [newlib-cygwin] Cygwin: get_posix_access: avoid negative subscript Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).