nfs4-acl-tools-0.3.2: Fix incorrect maximum ACE size computation

Labiaga, Ricardo Ricardo.Labiaga at netapp.com
Thu Jul 31 20:33:27 EDT 2008


Bruce,

nfs4_setfacl computes the maximum size of the ACL file incorrectly.  The
definition of NFS4_MAX_ACESIZE should be wrapped in parenthesis to
ensure the correct size is computed in the allocation of memory in
nfs4_acl_spec_from_file.c:nfs4_acl_spec_from_file().  The following
addresses this:


$ diff include/libacl_nfs4.h.orig include/libacl_nfs4.h
126c126
< #define NFS4_MAX_ACESIZE      4 + 2 + 2 + 10 + 128 + 14 + 2
---
> #define NFS4_MAX_ACESIZE      (4 + 2 + 2 + 10 + 128 + 14 + 2)


Without the parenthesis it only allocates 200 bytes, instead
of the intended 3240.

There's a more intrinsic bug in nfs4_acl_spec_from_file() though.  It
assumes that you're not going to have more than 20 ACEs in the ACL file
at a time, and that each principal will be less than 128 characters.  If
the size is exceeded then it silently overruns the buffer and starts
failing in random ways.

I'll send a fix to avoid the pre-allocation maximum (or at a minimum
fail gracefully) in the next few days.

Thanks,

- ricardo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux-nfs.org/pipermail/nfsv4/attachments/20080731/ed491ea2/attachment.htm 


More information about the NFSv4 mailing list