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
785e1540
Commit
785e1540
authored
Jun 09, 2020
by
Thomas Parrott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: Fix coverity issue, leaking data in lxc_ovs_setup_bridge_vlan_exec
Signed-off-by:
Thomas Parrott
<
thomas.parrott@canonical.com
>
parent
4e61b19d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
network.c
src/lxc/network.c
+9
-6
No files found.
src/lxc/network.c
View file @
785e1540
...
@@ -433,11 +433,14 @@ struct ovs_veth_vlan_args {
...
@@ -433,11 +433,14 @@ struct ovs_veth_vlan_args {
static
int
lxc_ovs_setup_bridge_vlan_exec
(
void
*
data
)
static
int
lxc_ovs_setup_bridge_vlan_exec
(
void
*
data
)
{
{
struct
ovs_veth_vlan_args
*
args
=
data
;
struct
ovs_veth_vlan_args
*
args
=
data
;
const
char
*
vlan_mode
=
""
,
*
tag
=
""
,
*
trunks
=
""
;
__do_free
char
*
vlan_mode
=
NULL
,
*
tag
=
NULL
,
*
trunks
=
NULL
;
if
(
!
args
->
vlan_mode
)
return
ret_errno
(
EINVAL
);
vlan_mode
=
must_concat
(
NULL
,
"vlan_mode="
,
args
->
vlan_mode
,
(
char
*
)
NULL
);
vlan_mode
=
must_concat
(
NULL
,
"vlan_mode="
,
args
->
vlan_mode
,
(
char
*
)
NULL
);
if
(
args
->
vlan_id
>
=
0
)
{
if
(
args
->
vlan_id
>
BRIDGE_VLAN_NONE
)
{
char
buf
[
5
];
char
buf
[
5
];
int
rc
;
int
rc
;
...
@@ -449,15 +452,15 @@ static int lxc_ovs_setup_bridge_vlan_exec(void *data)
...
@@ -449,15 +452,15 @@ static int lxc_ovs_setup_bridge_vlan_exec(void *data)
}
}
if
(
strcmp
(
args
->
trunks
,
""
)
!=
0
)
if
(
args
->
trunks
)
trunks
=
must_concat
(
NULL
,
"trunks="
,
args
->
trunks
,
(
char
*
)
NULL
);
trunks
=
must_concat
(
NULL
,
"trunks="
,
args
->
trunks
,
(
char
*
)
NULL
);
/* Detect the combination of vlan_id and trunks specified and convert to ovs-vsctl command. */
/* Detect the combination of vlan_id and trunks specified and convert to ovs-vsctl command. */
if
(
strcmp
(
tag
,
""
)
!=
0
&&
strcmp
(
trunks
,
""
)
!=
0
)
if
(
tag
&&
trunks
)
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
tag
,
trunks
,
(
char
*
)
NULL
);
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
tag
,
trunks
,
(
char
*
)
NULL
);
else
if
(
strcmp
(
tag
,
""
)
!=
0
)
else
if
(
tag
)
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
tag
,
(
char
*
)
NULL
);
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
tag
,
(
char
*
)
NULL
);
else
if
(
strcmp
(
trunks
,
""
)
!=
0
)
else
if
(
trunks
)
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
trunks
,
(
char
*
)
NULL
);
execlp
(
"ovs-vsctl"
,
"ovs-vsctl"
,
"set"
,
"port"
,
args
->
nic
,
vlan_mode
,
trunks
,
(
char
*
)
NULL
);
else
else
return
-
EINVAL
;
return
-
EINVAL
;
...
...
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