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
a2eea3c1
Commit
a2eea3c1
authored
May 03, 2013
by
Dwight Engen
Committed by
Serge Hallyn
May 03, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: ensure string is null terminated, return in
error case Signed-off-by:
Dwight Engen
<
dwight.engen@oracle.com
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
2d4bcb96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
lxccontainer.c
src/lxc/lxccontainer.c
+3
-1
No files found.
src/lxc/lxccontainer.c
View file @
a2eea3c1
...
@@ -1160,10 +1160,11 @@ static int update_name_and_paths(const char *path, struct lxc_container *oldc,
...
@@ -1160,10 +1160,11 @@ static int update_name_and_paths(const char *path, struct lxc_container *oldc,
SYSERROR
(
"rewinding old config"
);
SYSERROR
(
"rewinding old config"
);
return
-
1
;
return
-
1
;
}
}
contents
=
malloc
(
flen
);
contents
=
malloc
(
flen
+
1
);
if
(
!
contents
)
{
if
(
!
contents
)
{
SYSERROR
(
"out of memory"
);
SYSERROR
(
"out of memory"
);
fclose
(
f
);
fclose
(
f
);
return
-
1
;
}
}
if
(
fread
(
contents
,
1
,
flen
,
f
)
!=
flen
)
{
if
(
fread
(
contents
,
1
,
flen
,
f
)
!=
flen
)
{
free
(
contents
);
free
(
contents
);
...
@@ -1171,6 +1172,7 @@ static int update_name_and_paths(const char *path, struct lxc_container *oldc,
...
@@ -1171,6 +1172,7 @@ static int update_name_and_paths(const char *path, struct lxc_container *oldc,
SYSERROR
(
"reading old config"
);
SYSERROR
(
"reading old config"
);
return
-
1
;
return
-
1
;
}
}
contents
[
flen
]
=
'\0'
;
if
(
fclose
(
f
)
<
0
)
{
if
(
fclose
(
f
)
<
0
)
{
free
(
contents
);
free
(
contents
);
SYSERROR
(
"closing old config"
);
SYSERROR
(
"closing old config"
);
...
...
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