From: Samuel Holland Date: Sat, 29 May 2021 03:14:04 +0000 (-0500) Subject: libext2fs: improve error handling in POSIX ACL conversions X-Git-Tag: v1.46.4~50 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ea97af65c5194137cec7bd770b79cd601d2a92a0;p=tools%2Fe2fsprogs.git 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 --- diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index 4f6371d..efe4d29 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++; }