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
f08fee55
Commit
f08fee55
authored
Sep 07, 2015
by
Christian Brauner
Committed by
Serge Hallyn
Sep 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use strlen() on non-null terminated buffer
Signed-off-by:
Christian Brauner
<
christianvanbrauner@gmail.com
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
61111832
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
lxccontainer.c
src/lxc/lxccontainer.c
+5
-2
No files found.
src/lxc/lxccontainer.c
View file @
f08fee55
...
@@ -1989,7 +1989,7 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
...
@@ -1989,7 +1989,7 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
char
newpath
[
MAXPATHLEN
];
char
newpath
[
MAXPATHLEN
];
int
fd
,
ret
,
n
=
0
,
v
=
0
;
int
fd
,
ret
,
n
=
0
,
v
=
0
;
bool
bret
=
false
;
bool
bret
=
false
;
size_t
len
;
size_t
len
,
difflen
;
if
(
container_disk_lock
(
c0
))
if
(
container_disk_lock
(
c0
))
return
false
;
return
false
;
...
@@ -2074,7 +2074,10 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
...
@@ -2074,7 +2074,10 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
* a multiple of a pagesize. Hence, we'll use memmem(). */
* a multiple of a pagesize. Hence, we'll use memmem(). */
if
((
del
=
memmem
(
buf
,
fbuf
.
st_size
,
newpath
,
len
)))
{
if
((
del
=
memmem
(
buf
,
fbuf
.
st_size
,
newpath
,
len
)))
{
/* remove container entry */
/* remove container entry */
memmove
(
del
,
del
+
len
,
strlen
(
del
)
-
len
+
1
);
if
(
del
!=
buf
+
fbuf
.
st_size
-
len
)
{
difflen
=
fbuf
.
st_size
-
(
del
-
buf
);
memmove
(
del
,
del
+
len
,
strnlen
(
del
,
difflen
)
-
len
);
}
munmap
(
buf
,
fbuf
.
st_size
);
munmap
(
buf
,
fbuf
.
st_size
);
...
...
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