Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
74768337
Commit
74768337
authored
May 08, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Fix xattr_to_text() unsafety
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
61692c78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
fs/bcachefs/xattr.c
fs/bcachefs/xattr.c
+10
-4
No files found.
fs/bcachefs/xattr.c
View file @
74768337
...
...
@@ -118,11 +118,17 @@ void bch2_xattr_to_text(struct printbuf *out, struct bch_fs *c,
else
prt_printf
(
out
,
"(unknown type %u)"
,
xattr
.
v
->
x_type
);
unsigned
name_len
=
xattr
.
v
->
x_name_len
;
unsigned
val_len
=
le16_to_cpu
(
xattr
.
v
->
x_val_len
);
unsigned
max_name_val_bytes
=
bkey_val_bytes
(
xattr
.
k
)
-
offsetof
(
struct
bch_xattr
,
x_name
);
val_len
=
min_t
(
int
,
val_len
,
max_name_val_bytes
-
name_len
);
name_len
=
min
(
name_len
,
max_name_val_bytes
);
prt_printf
(
out
,
"%.*s:%.*s"
,
xattr
.
v
->
x_name_len
,
xattr
.
v
->
x_name
,
le16_to_cpu
(
xattr
.
v
->
x_val_len
),
(
char
*
)
xattr_val
(
xattr
.
v
));
name_len
,
xattr
.
v
->
x_name
,
val_len
,
(
char
*
)
xattr_val
(
xattr
.
v
));
if
(
xattr
.
v
->
x_type
==
KEY_TYPE_XATTR_INDEX_POSIX_ACL_ACCESS
||
xattr
.
v
->
x_type
==
KEY_TYPE_XATTR_INDEX_POSIX_ACL_DEFAULT
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment