Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2009 07:20:52 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192966 - head/lib/libc/posix1e
Message-ID:  <200905280720.n4S7KqFL026821@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905280720.n4S7KqFL026821>