Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
dc117b6b
Unverified
Commit
dc117b6b
authored
Apr 18, 2021
by
Christian Brauner
Committed by
GitHub
Apr 18, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3799 from evverx/apparmor-bytes
apparmor: turn bytes into null-terminated strings before calling strcspn
parents
44990884
699e7f88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
apparmor.c
src/lxc/lsm/apparmor.c
+8
-1
No files found.
src/lxc/lsm/apparmor.c
View file @
dc117b6b
...
@@ -431,6 +431,7 @@ error:
...
@@ -431,6 +431,7 @@ error:
static
char
*
apparmor_process_label_get
(
struct
lsm_ops
*
ops
,
pid_t
pid
)
static
char
*
apparmor_process_label_get
(
struct
lsm_ops
*
ops
,
pid_t
pid
)
{
{
__do_close
int
fd_label
=
-
EBADF
;
__do_close
int
fd_label
=
-
EBADF
;
__do_free
char
*
buf
=
NULL
;
__do_free
char
*
label
=
NULL
;
__do_free
char
*
label
=
NULL
;
int
ret
;
int
ret
;
size_t
len
;
size_t
len
;
...
@@ -439,13 +440,19 @@ static char *apparmor_process_label_get(struct lsm_ops *ops, pid_t pid)
...
@@ -439,13 +440,19 @@ static char *apparmor_process_label_get(struct lsm_ops *ops, pid_t pid)
if
(
fd_label
<
0
)
if
(
fd_label
<
0
)
return
NULL
;
return
NULL
;
ret
=
fd_to_buf
(
fd_label
,
&
label
,
&
len
);
ret
=
fd_to_buf
(
fd_label
,
&
buf
,
&
len
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
NULL
;
return
NULL
;
if
(
len
==
0
)
if
(
len
==
0
)
return
NULL
;
return
NULL
;
label
=
malloc
(
len
+
1
);
if
(
!
label
)
return
NULL
;
memcpy
(
label
,
buf
,
len
);
label
[
len
]
=
'\0'
;
len
=
strcspn
(
label
,
"
\n
\t
"
);
len
=
strcspn
(
label
,
"
\n
\t
"
);
if
(
len
)
if
(
len
)
label
[
len
]
=
'\0'
;
label
[
len
]
=
'\0'
;
...
...
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