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
0a7f6089
Unverified
Commit
0a7f6089
authored
Nov 28, 2017
by
Felix Abecassis
Committed by
Christian Brauner
Dec 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: error out if a network configuration key has no subkey
This prevent an infinite recursion in the case of "lxc.net.0. = a" Signed-off-by:
Felix Abecassis
<
fabecassis@nvidia.com
>
parent
46efc088
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
confile.c
src/lxc/confile.c
+4
-0
confile_legacy.c
src/lxc/confile_legacy.c
+4
-0
parse_config_file.c
src/tests/parse_config_file.c
+10
-0
No files found.
src/lxc/confile.c
View file @
0a7f6089
...
...
@@ -3628,6 +3628,10 @@ static struct lxc_config_t *get_network_config_ops(const char *key,
/* lxc.net.<idx>.<subkey> */
if
(
idx_end
)
{
*
idx_end
=
'.'
;
if
(
strlen
(
idx_end
+
1
)
==
0
)
{
ERROR
(
"No subkey in network configuration key
\"
%s
\"
"
,
key
);
goto
on_error
;
}
memmove
(
copy
+
8
,
idx_end
+
1
,
strlen
(
idx_end
+
1
));
copy
[
strlen
(
key
)
-
numstrlen
+
1
]
=
'\0'
;
...
...
src/lxc/confile_legacy.c
View file @
0a7f6089
...
...
@@ -90,6 +90,10 @@ int set_config_network_legacy_nic(const char *key, const char *value,
if
(
!
p
)
goto
out
;
if
(
strlen
(
p
+
1
)
==
0
)
{
ERROR
(
"No subkey in network configuration key
\"
%s
\"
"
,
key
);
goto
out
;
}
strcpy
(
copy
+
12
,
p
+
1
);
config
=
lxc_get_config
(
copy
);
if
(
!
config
)
{
...
...
src/tests/parse_config_file.c
View file @
0a7f6089
...
...
@@ -166,6 +166,16 @@ static int set_invalid_netdev(struct lxc_container *c) {
return
-
1
;
}
if
(
c
->
set_config_item
(
c
,
"lxc.net.0."
,
"veth"
))
{
lxc_error
(
"%s
\n
"
,
"lxc.net.0. should be invalid"
);
return
-
1
;
}
if
(
c
->
set_config_item
(
c
,
"lxc.network.0."
,
"veth"
))
{
lxc_error
(
"%s
\n
"
,
"lxc.network.0. should be invalid"
);
return
-
1
;
}
c
->
clear_config
(
c
);
c
->
lxc_conf
=
NULL
;
...
...
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