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
f0489268
Unverified
Commit
f0489268
authored
Mar 26, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: handle empty log name
Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32491
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
a842308f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
confile.c
src/lxc/confile.c
+3
-0
log.c
src/lxc/log.c
+10
-1
parse_config_file.c
src/tests/parse_config_file.c
+5
-0
No files found.
src/lxc/confile.c
View file @
f0489268
...
@@ -1461,6 +1461,9 @@ static int set_config_log_file(const char *key, const char *value,
...
@@ -1461,6 +1461,9 @@ static int set_config_log_file(const char *key, const char *value,
return
0
;
return
0
;
}
}
if
(
!
abspath
(
value
))
return
ret_errno
(
EINVAL
);
/*
/*
* Store these values in the lxc_conf, and then try to set for actual
* Store these values in the lxc_conf, and then try to set for actual
* current logging.
* current logging.
...
...
src/lxc/log.c
View file @
f0489268
...
@@ -489,6 +489,12 @@ static int build_dir(const char *name)
...
@@ -489,6 +489,12 @@ static int build_dir(const char *name)
__do_free
char
*
n
=
NULL
;
__do_free
char
*
n
=
NULL
;
char
*
e
,
*
p
;
char
*
e
,
*
p
;
if
(
is_empty_string
(
name
))
return
ret_errno
(
EINVAL
);
if
(
!
abspath
(
name
))
return
ret_errno
(
EINVAL
);
/* Make copy of the string since we'll be modifying it. */
/* Make copy of the string since we'll be modifying it. */
n
=
strdup
(
name
);
n
=
strdup
(
name
);
if
(
!
n
)
if
(
!
n
)
...
@@ -604,7 +610,7 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
...
@@ -604,7 +610,7 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
if
(
lxc_log_fd
>=
0
)
if
(
lxc_log_fd
>=
0
)
lxc_log_close
();
lxc_log_close
();
if
(
!
fname
)
if
(
is_empty_string
(
fname
)
)
return
ret_errno
(
EINVAL
);
return
ret_errno
(
EINVAL
);
if
(
strlen
(
fname
)
==
0
)
{
if
(
strlen
(
fname
)
==
0
)
{
...
@@ -820,6 +826,9 @@ int lxc_log_set_file(int *fd, const char *fname)
...
@@ -820,6 +826,9 @@ int lxc_log_set_file(int *fd, const char *fname)
if
(
*
fd
>=
0
)
if
(
*
fd
>=
0
)
close_prot_errno_disarm
(
*
fd
);
close_prot_errno_disarm
(
*
fd
);
if
(
is_empty_string
(
fname
))
return
ret_errno
(
EINVAL
);
if
(
build_dir
(
fname
))
if
(
build_dir
(
fname
))
return
-
errno
;
return
-
errno
;
...
...
src/tests/parse_config_file.c
View file @
f0489268
...
@@ -884,6 +884,11 @@ int main(int argc, char *argv[])
...
@@ -884,6 +884,11 @@ int main(int argc, char *argv[])
return
-
1
;
return
-
1
;
}
}
if
(
c
->
set_config_item
(
c
,
"lxc.log.file="
,
"./"
))
{
lxc_error
(
"%s
\n
"
,
"Managed to set to set invalid config item
\"
lxc.log.file
\"
to
\"
./
\"
"
);
return
-
1
;
}
fret
=
EXIT_SUCCESS
;
fret
=
EXIT_SUCCESS
;
non_test_error:
non_test_error:
...
...
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