ipacm: Fix KW issues
Make changes to initialize variables and use stlcpy for
string copy.
Change-Id: I2b5b1f4eedda71dc7df62a3a94229392f98f8042
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index eb30e0f..4b02b57 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -474,7 +474,7 @@
if (ipa_nat_iface_entries < ipa_num_ipa_interfaces)
{
- memcpy(pNatIfaces[ipa_nat_iface_entries - 1].iface_name,
+ strlcpy(pNatIfaces[ipa_nat_iface_entries - 1].iface_name,
dev_name, IPA_IFACE_NAME_LEN);
IPACMDBG_H("Add Nat IfaceName: %s ,update nat-ifaces number: %d\n",
diff --git a/ipacm/src/IPACM_ConntrackListener.cpp b/ipacm/src/IPACM_ConntrackListener.cpp
index 53873cd..ad3fa1e 100644
--- a/ipacm/src/IPACM_ConntrackListener.cpp
+++ b/ipacm/src/IPACM_ConntrackListener.cpp
@@ -210,8 +210,8 @@
sizeof(pNatIfaces[i].iface_name)) == 0)
{
IPACMDBG_H("Nat iface (%s), entry (%d), dont cache",
- pNatIfaces[i].iface_name, j);
- iptodot("with ipv4 address: ", nat_iface_ipv4_addr[j]);
+ pNatIfaces[i].iface_name, i);
+ iptodot("with ipv4 address: ", nat_iface_ipv4_addr[i]);
*NatIface = true;
return IPACM_SUCCESS;
}
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index f8ed9d8..1727eaf 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -74,6 +74,17 @@
return;
}
+ num_wan_ul_fl_rule_v4 = 0;
+ num_wan_ul_fl_rule_v6 = 0;
+ is_active = true;
+ modem_ul_v4_set = false;
+ modem_ul_v6_set = false;
+ is_mode_switch = false;
+ if_ipv4_subnet =0;
+ each_client_rt_rule_count[IPA_IP_v4] = 0;
+ each_client_rt_rule_count[IPA_IP_v6] = 0;
+ eth_client_len = 0;
+
/* support eth multiple clients */
if(iface_query != NULL)
{
@@ -104,22 +115,14 @@
}
}
- num_wan_ul_fl_rule_v4 = 0;
- num_wan_ul_fl_rule_v6 = 0;
-
memset(wan_ul_fl_rule_hdl_v4, 0, MAX_WAN_UL_FILTER_RULES * sizeof(uint32_t));
memset(wan_ul_fl_rule_hdl_v6, 0, MAX_WAN_UL_FILTER_RULES * sizeof(uint32_t));
- is_active = true;
memset(ipv4_icmp_flt_rule_hdl, 0, NUM_IPV4_ICMP_FLT_RULE * sizeof(uint32_t));
- is_mode_switch = false;
- if_ipv4_subnet =0;
memset(private_fl_rule_hdl, 0, IPA_MAX_PRIVATE_SUBNET_ENTRIES * sizeof(uint32_t));
memset(ipv6_prefix_flt_rule_hdl, 0, NUM_IPV6_PREFIX_FLT_RULE * sizeof(uint32_t));
memset(ipv6_icmp_flt_rule_hdl, 0, NUM_IPV6_ICMP_FLT_RULE * sizeof(uint32_t));
- modem_ul_v4_set = false;
- modem_ul_v6_set = false;
memset(ipv6_prefix, 0, sizeof(ipv6_prefix));
/* ODU routing table initilization */
@@ -157,8 +160,6 @@
}
}
- each_client_rt_rule_count[IPA_IP_v4] = 0;
- each_client_rt_rule_count[IPA_IP_v6] = 0;
if(iface_query != NULL && tx_prop != NULL)
{
for(i=0; i<iface_query->num_tx_props; i++)
diff --git a/ipacm/src/IPACM_Neighbor.cpp b/ipacm/src/IPACM_Neighbor.cpp
index 5a72c4c..b96cebb 100644
--- a/ipacm/src/IPACM_Neighbor.cpp
+++ b/ipacm/src/IPACM_Neighbor.cpp
@@ -76,7 +76,7 @@
IPACMERR("IPA_WLAN_CLIENT_ADD_EVENT_EX: not supported iface id: %d\n", data->if_index);
break;
}
- uint8_t client_mac_addr[6];
+ uint8_t client_mac_addr[6] = {0};
IPACMDBG_H("Received IPA_WLAN_CLIENT_ADD_EVENT\n");
for(i = 0; i < data->num_of_attribs; i++)
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 4e6b396..921ddd6 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -129,6 +129,9 @@
is_xlat = false;
hdr_hdl_dummy_v6 = 0;
hdr_proc_hdl_dummy_v6 = 0;
+ is_default_gateway = false;
+ m_fd_ipa = 0;
+ wan_client_len = 0;
if(iface_query != NULL)
{
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 3bf95f2..2152c4d 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -83,6 +83,7 @@
num_wifi_client = 0;
header_name_count = 0;
wlan_client = NULL;
+ wlan_client_len = 0;
if(iface_query != NULL)
{
diff --git a/ipacm/src/IPACM_Xml.cpp b/ipacm/src/IPACM_Xml.cpp
index 073dc98..6b19639 100644
--- a/ipacm/src/IPACM_Xml.cpp
+++ b/ipacm/src/IPACM_Xml.cpp
@@ -268,7 +268,7 @@
str_size = strlen(content);
memset(content_buf, 0, sizeof(content_buf));
memcpy(content_buf, (void *)content, str_size);
- strlcpy(config->iface_config.iface_entries[config->iface_config.num_iface_entries - 1].iface_name, content_buf, str_size+1);
+ strlcpy(config->iface_config.iface_entries[config->iface_config.num_iface_entries - 1].iface_name, content_buf, IPA_IFACE_NAME_LEN);
IPACMDBG_H("Name %s\n", config->iface_config.iface_entries[config->iface_config.num_iface_entries - 1].iface_name);
}
}