From: Thomas Parrott Date: Tue, 9 Jun 2020 11:03:40 +0000 (+0100) Subject: network: Fix coverity issue, dont initialise string pointers in setup_veth_ovs_bridge... X-Git-Tag: lxc-5.0.0~421^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ee07848e7cbfb9b0673167e8f40f20082e398b1;p=thirdparty%2Flxc.git network: Fix coverity issue, dont initialise string pointers in setup_veth_ovs_bridge_vlan This is needed by lxc_ovs_setup_bridge_vlan_exec. Signed-off-by: Thomas Parrott --- diff --git a/src/lxc/network.c b/src/lxc/network.c index 9691ec94a..84bfb6b39 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -473,9 +473,9 @@ static int setup_veth_ovs_bridge_vlan(char *veth1, struct lxc_netdev *netdev) int taggedLength = lxc_list_len(&netdev->priv.veth_attr.vlan_tagged_ids); struct ovs_veth_vlan_args args; args.nic = veth1; - args.vlan_mode = ""; - args.vlan_id = -1; - args.trunks = ""; + args.vlan_mode = NULL; + args.vlan_id = BRIDGE_VLAN_NONE; + args.trunks = NULL; /* Skip setup if no VLAN options are specified. */ if (!netdev->priv.veth_attr.vlan_id_set && taggedLength <= 0) @@ -515,11 +515,14 @@ static int setup_veth_ovs_bridge_vlan(char *veth1, struct lxc_netdev *netdev) if (rc < 0 || (size_t)rc >= sizeof(buf)) return log_error_errno(-1, EINVAL, "Failed to parse tagged vlan \"%u\" for interface \"%s\"", vlan_id, veth1); - args.trunks = must_concat(NULL, args.trunks, buf, ",", (char *)NULL); + if (args.trunks) + args.trunks = must_concat(NULL, args.trunks, buf, ",", (char *)NULL); + else + args.trunks = must_concat(NULL, buf, ",", (char *)NULL); } } - if (strcmp(args.vlan_mode, "") != 0) { + if (args.vlan_mode) { int ret; char cmd_output[PATH_MAX];