mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
9pfs: limit xattr size in xattrcreate
We shouldn't allow guests to create extended attribute with arbitrary sizes. On linux hosts, the limit is XATTR_SIZE_MAX. Let's use it. Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
7e55d65c56
commit
3b79ef2cf4
2 changed files with 7 additions and 2 deletions
|
@ -3247,7 +3247,7 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque)
|
|||
{
|
||||
int flags;
|
||||
int32_t fid;
|
||||
int64_t size;
|
||||
uint64_t size;
|
||||
ssize_t err = 0;
|
||||
V9fsString name;
|
||||
size_t offset = 7;
|
||||
|
@ -3262,6 +3262,11 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque)
|
|||
}
|
||||
trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);
|
||||
|
||||
if (size > XATTR_SIZE_MAX) {
|
||||
err = -E2BIG;
|
||||
goto out_nofid;
|
||||
}
|
||||
|
||||
file_fidp = get_fid(pdu, fid);
|
||||
if (file_fidp == NULL) {
|
||||
err = -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue