Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writer: Reject empty xattr names #400

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcomposefs/lcfs-writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ int lcfs_node_set_xattr_internal(struct lcfs_node_s *node, const char *name,
char *k, *v;

const size_t namelen = strlen(name);
if (namelen > XATTR_NAME_MAX) {
if (namelen == 0 || namelen > XATTR_NAME_MAX) {
errno = ERANGE;
return -1;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/assets/should-fail-empty-xattr-key.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/ 4096 40555 2 0 0 0 1633950376.0 - - -
/noxattr-key 0 100644 1 0 0 0 0.0 - - - =somevalue
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test_assets_small_extra = [

test_assets_should_fail = [
'should-fail-long-link.dump',
'should-fail-empty-xattr-key.dump',
'should-fail-long-xattr-key.dump',
'should-fail-long-xattr-value.dump',
'should-fail-honggfuzz-long-xattr.dump',
Expand Down
Loading