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
be5c06ec
Unverified
Commit
be5c06ec
authored
Oct 31, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: check for i/o error with vsnprintf()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a760603e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
log.c
src/lxc/log.c
+8
-3
No files found.
src/lxc/log.c
View file @
be5c06ec
...
@@ -264,7 +264,7 @@ static int log_append_logfile(const struct lxc_log_appender *appender,
...
@@ -264,7 +264,7 @@ static int log_append_logfile(const struct lxc_log_appender *appender,
{
{
char
buffer
[
LXC_LOG_BUFFER_SIZE
];
char
buffer
[
LXC_LOG_BUFFER_SIZE
];
char
date_time
[
LXC_LOG_TIME_SIZE
];
char
date_time
[
LXC_LOG_TIME_SIZE
];
int
n
;
int
n
,
ret
;
int
fd_to_use
=
-
1
;
int
fd_to_use
=
-
1
;
#ifndef NO_LXC_CONF
#ifndef NO_LXC_CONF
...
@@ -295,8 +295,13 @@ static int log_append_logfile(const struct lxc_log_appender *appender,
...
@@ -295,8 +295,13 @@ static int log_append_logfile(const struct lxc_log_appender *appender,
if
(
n
<
0
)
if
(
n
<
0
)
return
n
;
return
n
;
if
((
size_t
)
n
<
(
sizeof
(
buffer
)
-
1
))
if
((
size_t
)
n
<
(
sizeof
(
buffer
)
-
1
))
{
n
+=
vsnprintf
(
buffer
+
n
,
sizeof
(
buffer
)
-
n
,
event
->
fmt
,
*
event
->
vap
);
ret
=
vsnprintf
(
buffer
+
n
,
sizeof
(
buffer
)
-
n
,
event
->
fmt
,
*
event
->
vap
);
if
(
ret
<
0
)
return
0
;
n
+=
ret
;
}
if
((
size_t
)
n
>=
sizeof
(
buffer
))
if
((
size_t
)
n
>=
sizeof
(
buffer
))
n
=
sizeof
(
buffer
)
-
1
;
n
=
sizeof
(
buffer
)
-
1
;
...
...
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