svn commit: r192966 - head/lib/libc/posix1e

Edward Tomasz Napierala trasz at FreeBSD.org
Thu May 28 07:20:53 UTC 2009


Author: trasz
Date: Thu May 28 07:20:52 2009
New Revision: 192966
URL: http://svn.freebsd.org/changeset/base/192966

Log:
  Fix off by one error in acl_create_entry(3).
  
  Reviewed by:	rwatson@
  MFC after:	2 weeks

Modified:
  head/lib/libc/posix1e/acl_entry.c

Modified: head/lib/libc/posix1e/acl_entry.c
==============================================================================
--- head/lib/libc/posix1e/acl_entry.c	Thu May 28 07:15:08 2009	(r192965)
+++ head/lib/libc/posix1e/acl_entry.c	Thu May 28 07:20:52 2009	(r192966)
@@ -51,7 +51,12 @@ acl_create_entry(acl_t *acl_p, acl_entry
 
 	acl_int = &(*acl_p)->ats_acl;
 
-	if ((acl_int->acl_cnt >= ACL_MAX_ENTRIES) || (acl_int->acl_cnt < 0)) {
+	/*
+	 * +1, because we are checking if there is space left for one more
+	 * entry.
+	 */
+	if ((acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) ||
+	    (acl_int->acl_cnt < 0)) {
 		errno = EINVAL;
 		return (-1);
 	}


More information about the svn-src-all mailing list