From 60a8b6022dc27a2d41ff9bcb742a90742825c833 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Thu, 28 May 2009 07:20:52 +0000 Subject: [PATCH] Fix off by one error in acl_create_entry(3). Reviewed by: rwatson@ MFC after: 2 weeks --- lib/libc/posix1e/acl_entry.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libc/posix1e/acl_entry.c b/lib/libc/posix1e/acl_entry.c index aaef6113f6e..407aff1893a 100644 --- a/lib/libc/posix1e/acl_entry.c +++ b/lib/libc/posix1e/acl_entry.c @@ -51,7 +51,12 @@ acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p) 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); }