fs_ops: limit xattr value length

This commit is contained in:
CismonX 2025-01-27 23:48:37 +08:00
parent 18b801f960
commit 56fa90397d
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
2 changed files with 8 additions and 1 deletions

View file

@ -291,6 +291,8 @@ a trailing newline is automatically removed (if one exists).
Max file size limit.
Defaults to @t{32768}.
This limit also applies to extended attribute values.
@item -o no_sandbox
Do not enable sandboxing features (@pxref{Sandboxing}).

View file

@ -2350,7 +2350,11 @@ fs_op_setxattr (
size_t val_len,
int UNUSED_VAR(flags)
) {
int status = -ENOATTR;
int status = -ERANGE;
if (val_len > ctx.file_max) {
goto end;
}
status = -ENOATTR;
switch (INODE_SUBSYS_TYPE(ino)) {
case SUBSYS_TYPE_BOOKMARK:
@ -2358,6 +2362,7 @@ fs_op_setxattr (
break;
}
end:
send_reply(err, req, -status);
}