diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-12 12:23:49 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-05-12 12:24:50 -0700 |
commit | f01d8792778b637f7464533ac019e42f58adb310 (patch) | |
tree | c82d6fd54d9fad2b3a877607f6d9a75ec082be7b | |
parent | b851a965da62cd858d71b2e5a7261a211f00b297 (diff) | |
download | gnulib-f01d8792778b637f7464533ac019e42f58adb310.tar.gz |
file-has-acl: don’t access freed storage
Fix typo in previous patch, by not accessing freed storage
in the unusual case where the statck buffer is not large enough.
-rw-r--r-- | lib/file-has-acl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index 1edcd2cbd6..38bc806dc4 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -200,11 +200,13 @@ file_has_acl (char const *name, struct stat const *sb) || (S_ISDIR (sb->st_mode) && have_xattr (XATTR_NAME_POSIX_ACL_DEFAULT, listbuf, listsize)))); + bool nfsv4_acl_but_no_posix_acl + = ret == 0 && have_xattr (XATTR_NAME_NFSV4_ACL, listbuf, listsize); free (heapbuf); /* If there is an NFSv4 ACL but no POSIX ACL, follow up with a getxattr syscall to see whether the NFSv4 ACL is nontrivial. */ - if (ret == 0 && have_xattr (XATTR_NAME_NFSV4_ACL, listbuf, listsize)) + if (nfsv4_acl_but_no_posix_acl) { ret = getxattr (name, XATTR_NAME_NFSV4_ACL, stackbuf.xattr, sizeof stackbuf.xattr); |