From 1addb4d44032d9737bf829cebdf8b4b8998a6b44 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 27 Mar 2008 10:09:24 +0100 Subject: [PATCH] posix_acls: clarify loop condition code, removing unneeded counter variable. Coverity ID 545 falsely classified this as a NULL dereferencing bug. By putting the loop of walking the list of aces more naturely not using additional counters, it becomes much more obvious that it is not entered when dir_ace == NULL. The same modifications are done for the file_ace loop. Michael (cherry picked from commit 6dab6cf0647d7db01e5e472f8b5cf21395b7dbf0) --- source/smbd/posix_acls.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source/smbd/posix_acls.c b/source/smbd/posix_acls.c index f60329a039a..c3c9d2e60c4 100644 --- a/source/smbd/posix_acls.c +++ b/source/smbd/posix_acls.c @@ -2882,7 +2882,6 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn, { canon_ace *ace; enum security_ace_type nt_acl_type; - int i; if (nt4_compatible_acls() && dir_ace) { /* @@ -2948,9 +2947,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn, * Create the NT ACE list from the canonical ace lists. */ - ace = file_ace; - - for (i = 0; i < num_acls; i++, ace = ace->next) { + for (ace = file_ace; ace != NULL; ace = ace->next) { SEC_ACCESS acc; acc = map_canon_ace_perms(SNUM(conn), @@ -2977,9 +2974,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn, acc, 0); } - ace = dir_ace; - - for (i = 0; i < num_def_acls; i++, ace = ace->next) { + for (ace = dir_ace; ace != NULL; ace = ace->next) { SEC_ACCESS acc; acc = map_canon_ace_perms(SNUM(conn), -- 2.11.4.GIT