diff options
author | Jeff Layton <jlayton@samba.org> | 2013-01-29 07:08:48 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@samba.org> | 2013-01-29 07:15:45 -0500 |
commit | 653a6c66312382da381a2d44f8018d3222cadbdf (patch) | |
tree | bd0532cf98ba38a2dd5090a24466b68b206a61d4 | |
parent | fb9999a9d20495719f3fa323401b087ebef60a0d (diff) | |
download | cifs-utils-653a6c66312382da381a2d44f8018d3222cadbdf.tar.gz cifs-utils-653a6c66312382da381a2d44f8018d3222cadbdf.tar.bz2 cifs-utils-653a6c66312382da381a2d44f8018d3222cadbdf.zip |
setcifsacl: fix offset calculation in "set" code
Previously the code assumed that the ACE that was copied was of a
fixed size. Save off the return value from copy_ace and ensure that
we apply it correctly to the size and offset.
Reported-by: Jian Li <jiali@redhat.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r-- | setcifsacl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/setcifsacl.c b/setcifsacl.c index 7f92b91..67dd29c 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -183,7 +183,7 @@ static int ace_set(struct cifs_ntsd *pntsd, struct cifs_ntsd **npntsd, ssize_t *bufsize, struct cifs_ace **cacesptr, int numcaces) { - int i, rc, acessize = 0; + int i, rc, size = 0, acessize = 0; size_t acesoffset; char *acesptr; @@ -193,8 +193,9 @@ ace_set(struct cifs_ntsd *pntsd, struct cifs_ntsd **npntsd, ssize_t *bufsize, acesptr = (char *)*npntsd + acesoffset; for (i = 0; i < numcaces; ++i) { - acessize += copy_ace((struct cifs_ace *)acesptr, cacesptr[i]); - acesptr += sizeof(struct cifs_ace); + size = copy_ace((struct cifs_ace *)acesptr, cacesptr[i]); + acessize += size; + acesptr += size; } copy_sec_desc(pntsd, *npntsd, numcaces, acessize); acesptr = (char *)*npntsd + acesoffset; |