aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2021-05-28 22:14:04 -0500
committerTheodore Ts'o <tytso@mit.edu>2021-07-30 13:38:14 -0400
commitea97af65c5194137cec7bd770b79cd601d2a92a0 (patch)
tree340801d9dd8b4e28adab117af22d2cbbb64728be
parent165c854118a427537ad878ec5ebad5467b536312 (diff)
downloade2fsprogs-ea97af65c5194137cec7bd770b79cd601d2a92a0.tar.gz
libext2fs: improve error handling in POSIX ACL conversions
When encoding a POSIX ACL to the EXT4 ACL format, if an unknown tag is encountered, that entry is silently ignored. It would be better to return an error to inform the user that the ACL is incompatible. Also fix the mismatched indentation in the opposite function. Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r--lib/ext2fs/ext_attr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c
index 4f6371deb..efe4d29f2 100644
--- a/lib/ext2fs/ext_attr.c
+++ b/lib/ext2fs/ext_attr.c
@@ -573,6 +573,8 @@ static errcode_t convert_posix_acl_to_disk_buffer(const void *value, size_t size
e += sizeof(ext4_acl_entry);
s += sizeof(ext4_acl_entry);
break;
+ default:
+ return EINVAL;
}
}
*size_out = s;
@@ -626,9 +628,9 @@ static errcode_t convert_disk_buffer_to_posix_acl(const void *value, size_t size
cp += sizeof(ext4_acl_entry);
size -= sizeof(ext4_acl_entry);
break;
- default:
- ext2fs_free_mem(&out);
- return EINVAL;
+ default:
+ ext2fs_free_mem(&out);
+ return EINVAL;
}
entry++;
}