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
cbc2ddf5
Unverified
Commit
cbc2ddf5
authored
Feb 03, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: harden __safe_mount_beneath_at()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
952b5031
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
utils.c
src/lxc/utils.c
+3
-3
No files found.
src/lxc/utils.c
View file @
cbc2ddf5
...
@@ -1081,8 +1081,8 @@ int __safe_mount_beneath_at(int beneath_fd, const char *src, const char *dst, co
...
@@ -1081,8 +1081,8 @@ int __safe_mount_beneath_at(int beneath_fd, const char *src, const char *dst, co
{
{
__do_close
int
source_fd
=
-
EBADF
,
target_fd
=
-
EBADF
;
__do_close
int
source_fd
=
-
EBADF
,
target_fd
=
-
EBADF
;
struct
lxc_open_how
how
=
{
struct
lxc_open_how
how
=
{
.
flags
=
O_RDONLY
|
O_CLOEXEC
|
O_PATH
,
.
flags
=
PROTECT_OPATH_DIRECTORY
,
.
resolve
=
RESOLVE_NO_SYMLINKS
|
RESOLVE_NO_MAGICLINKS
|
RESOLVE_BENEATH
,
.
resolve
=
PROTECT_LOOKUP_BENEATH_WITH_MAGICLINKS
,
};
};
int
ret
;
int
ret
;
char
src_buf
[
LXC_PROC_PID_FD_LEN
],
tgt_buf
[
LXC_PROC_PID_FD_LEN
];
char
src_buf
[
LXC_PROC_PID_FD_LEN
],
tgt_buf
[
LXC_PROC_PID_FD_LEN
];
...
@@ -1122,7 +1122,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co
...
@@ -1122,7 +1122,7 @@ int safe_mount_beneath(const char *beneath, const char *src, const char *dst, co
__do_close
int
beneath_fd
=
-
EBADF
;
__do_close
int
beneath_fd
=
-
EBADF
;
const
char
*
path
=
beneath
?
beneath
:
"/"
;
const
char
*
path
=
beneath
?
beneath
:
"/"
;
beneath_fd
=
openat
(
-
1
,
path
,
O_RDONLY
|
O_CLOEXEC
|
O_DIRECTORY
|
O_PATH
);
beneath_fd
=
openat
(
-
1
,
path
,
PROTECT_OPATH_DIRECTORY
);
if
(
beneath_fd
<
0
)
if
(
beneath_fd
<
0
)
return
log_error_errno
(
-
errno
,
errno
,
"Failed to open %s"
,
path
);
return
log_error_errno
(
-
errno
,
errno
,
"Failed to open %s"
,
path
);
...
...
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