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
053ec268
Unverified
Commit
053ec268
authored
Dec 04, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: prevent null pointer dereference
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
cbe31267
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
conf.c
src/lxc/conf.c
+11
-9
utils.c
src/lxc/utils.c
+1
-1
No files found.
src/lxc/conf.c
View file @
053ec268
...
@@ -1739,11 +1739,12 @@ static int mount_entry(const char *fsname, const char *target,
...
@@ -1739,11 +1739,12 @@ static int mount_entry(const char *fsname, const char *target,
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
optional
)
{
if
(
optional
)
{
INFO
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
(optional): %s"
,
INFO
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
(optional): %s"
,
fsname
,
target
,
strerror
(
errno
));
fsname
?
fsname
:
"(null)"
,
target
,
strerror
(
errno
));
return
0
;
return
0
;
}
}
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
,
target
);
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
?
fsname
:
"(null)"
,
target
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1751,13 +1752,12 @@ static int mount_entry(const char *fsname, const char *target,
...
@@ -1751,13 +1752,12 @@ static int mount_entry(const char *fsname, const char *target,
unsigned
long
rqd_flags
=
0
;
unsigned
long
rqd_flags
=
0
;
DEBUG
(
"Remounting
\"
%s
\"
on
\"
%s
\"
to respect bind or remount "
DEBUG
(
"Remounting
\"
%s
\"
on
\"
%s
\"
to respect bind or remount "
"options"
,
"options"
,
fsname
?
fsname
:
"(none)"
,
target
?
target
:
"(none)"
);
fsname
?
fsname
:
"(none)"
,
target
?
target
:
"(none)"
);
if
(
mountflags
&
MS_RDONLY
)
if
(
mountflags
&
MS_RDONLY
)
rqd_flags
|=
MS_RDONLY
;
rqd_flags
|=
MS_RDONLY
;
#ifdef HAVE_STATVFS
#ifdef HAVE_STATVFS
if
(
statvfs
(
fsname
,
&
sb
)
==
0
)
{
if
(
fsname
&&
statvfs
(
fsname
,
&
sb
)
==
0
)
{
unsigned
long
required_flags
=
rqd_flags
;
unsigned
long
required_flags
=
rqd_flags
;
if
(
sb
.
f_flag
&
MS_NOSUID
)
if
(
sb
.
f_flag
&
MS_NOSUID
)
...
@@ -1796,12 +1796,14 @@ static int mount_entry(const char *fsname, const char *target,
...
@@ -1796,12 +1796,14 @@ static int mount_entry(const char *fsname, const char *target,
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
optional
)
{
if
(
optional
)
{
INFO
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
INFO
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
"(optional): %s"
,
fsname
,
target
,
"(optional): %s"
,
fsname
?
fsname
:
"(null)"
,
target
,
strerror
(
errno
));
strerror
(
errno
));
return
0
;
return
0
;
}
}
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
,
target
);
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
?
fsname
:
"(null)"
,
target
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -1809,8 +1811,8 @@ static int mount_entry(const char *fsname, const char *target,
...
@@ -1809,8 +1811,8 @@ static int mount_entry(const char *fsname, const char *target,
#ifdef HAVE_STATVFS
#ifdef HAVE_STATVFS
skipremount:
skipremount:
#endif
#endif
DEBUG
(
"Mounted
\"
%s
\"
on
\"
%s
\"
with filesystem type
\"
%s
\"
"
,
fsname
,
DEBUG
(
"Mounted
\"
%s
\"
on
\"
%s
\"
with filesystem type
\"
%s
\"
"
,
target
,
fstype
);
fsname
?
fsname
:
"(null)"
,
target
,
fstype
);
return
0
;
return
0
;
}
}
...
...
src/lxc/utils.c
View file @
053ec268
...
@@ -1705,7 +1705,7 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
...
@@ -1705,7 +1705,7 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
close
(
destfd
);
close
(
destfd
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
errno
=
saved_errno
;
errno
=
saved_errno
;
SYSERROR
(
"Failed to mount %s onto %s"
,
src
,
dest
);
SYSERROR
(
"Failed to mount %s onto %s"
,
src
?
src
:
"(null)"
,
dest
);
return
ret
;
return
ret
;
}
}
...
...
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