Merge "Support strict conservative peer mode for EAP-SIM/AKA/AKA'"
diff --git a/hostapd/Android.bp b/hostapd/Android.bp
index 3194d36..020396d 100644
--- a/hostapd/Android.bp
+++ b/hostapd/Android.bp
@@ -169,6 +169,35 @@
"-Wno-unused-variable",
"-Wno-macro-redefined",
],
+ // Similar to suppressing clang compiler warnings, here we
+ // suppress clang-tidy warnings to reduce noises in Android build.log.
+ tidy_checks: [
+ "-android-cloexec-*",
+ "-bugprone-branch-clone",
+ "-bugprone-macro-parentheses",
+ "-bugprone-misplaced-widening-cast",
+ "-bugprone-signal-handler",
+ "-bugprone-signed-char-misuse",
+ "-bugprone-sizeof-expression",
+ "-bugprone-suspicious-string-compare",
+ "-bugprone-too-small-loop-variable",
+ "-cert-err34-c",
+ "-cert-msc30-c",
+ "-cert-msc50-cpp",
+ "-cert-msc54-cpp",
+ "-cert-sig30-c",
+ "-cert-str34-c",
+ "-clang-analyzer-core.NullDereference",
+ "-clang-analyzer-core.UndefinedBinaryOperatorResult",
+ "-clang-analyzer-deadcode.DeadStores",
+ "-clang-analyzer-optin.performance.Padding",
+ "-clang-analyzer-optin.portability.UnixAPI",
+ "-clang-analyzer-security.insecureAPI.UncheckedReturn",
+ "-clang-analyzer-unix.cstring.NullArg",
+ "-clang-analyzer-unix.Malloc",
+ "-clang-diagnostic-unused-but-set-variable",
+ "-misc-redundant-expression",
+ ],
}
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index f2200d6..35bfbe7 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -702,6 +702,9 @@
const std::vector<uint8_t>& client_address,
const uint16_t reason_code) {
struct sta_info *sta;
+ if (client_address.size() != ETH_ALEN) {
+ return false;
+ }
for (sta = hapd->sta_list; sta; sta = sta->next) {
int res;
res = memcmp(sta->addr, client_address.data(), ETH_ALEN);
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp
index 01f6662..05c79c0 100644
--- a/wpa_supplicant/Android.bp
+++ b/wpa_supplicant/Android.bp
@@ -216,6 +216,35 @@
"-Wno-unused-parameter",
"-Wno-unused-variable",
],
+ // Similar to suppressing clang compiler warnings, here we
+ // suppress clang-tidy warnings to reduce noises in Android build.log.
+ tidy_checks: [
+ "-android-cloexec-*",
+ "-bugprone-branch-clone",
+ "-bugprone-macro-parentheses",
+ "-bugprone-misplaced-widening-cast",
+ "-bugprone-signal-handler",
+ "-bugprone-signed-char-misuse",
+ "-bugprone-sizeof-expression",
+ "-bugprone-suspicious-string-compare",
+ "-bugprone-too-small-loop-variable",
+ "-cert-err34-c",
+ "-cert-msc30-c",
+ "-cert-msc50-cpp",
+ "-cert-msc54-cpp",
+ "-cert-sig30-c",
+ "-cert-str34-c",
+ "-clang-analyzer-core.NullDereference",
+ "-clang-analyzer-core.UndefinedBinaryOperatorResult",
+ "-clang-analyzer-deadcode.DeadStores",
+ "-clang-analyzer-optin.performance.Padding",
+ "-clang-analyzer-optin.portability.UnixAPI",
+ "-clang-analyzer-security.insecureAPI.UncheckedReturn",
+ "-clang-analyzer-unix.cstring.NullArg",
+ "-clang-analyzer-unix.Malloc",
+ "-clang-diagnostic-unused-but-set-variable",
+ "-misc-redundant-expression",
+ ],
}
// Generated by building wpa_supplicant and printing LOCAL_SRC_FILES.
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index 1fd015b..b19895b 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -1287,6 +1287,9 @@
if (go_intent > 15) {
return {"", createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID)};
}
+ if (peer_address.size() != ETH_ALEN) {
+ return {"", createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID)};
+ }
int go_intent_signed = join_existing_group ? -1 : go_intent;
p2p_wps_method wps_method = {};
switch (provision_method) {
@@ -1382,6 +1385,9 @@
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) {
return createStatus(SupplicantStatusCode::FAILURE_IFACE_DISABLED);
}
+ if (peer_address.size() != ETH_ALEN) {
+ return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ }
if (wpas_p2p_reject(wpa_s, peer_address.data())) {
return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
}
@@ -1394,6 +1400,9 @@
const std::vector<uint8_t>& peer_address)
{
struct wpa_supplicant* wpa_s = retrieveIfacePtr();
+ if (peer_address.size() != ETH_ALEN) {
+ return {createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
+ }
if (wpas_p2p_invite_group(
wpa_s, group_ifname.c_str(), peer_address.data(),
go_device_address.data(), is6GhzAllowed(wpa_s))) {
@@ -1416,6 +1425,9 @@
if (ssid == NULL || ssid->disabled != 2) {
return createStatus(SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN);
}
+ if (peer_address.size() != ETH_ALEN) {
+ return {createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
+ }
if (wpas_p2p_invite(
wpa_s, peer_address.data(), ssid, NULL, 0, 0, ht40, vht,
CONF_OPER_CHWIDTH_USE_HT, 0, he, edmg, is6GhzAllowed(wpa_s))) {
@@ -1579,6 +1591,9 @@
if (!query_buf) {
return {0, createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
+ if (peer_address.size() != ETH_ALEN) {
+ return {0, createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
+ }
const uint8_t* dst_addr = is_zero_ether_addr(peer_address.data())
? nullptr
: peer_address.data();
@@ -1625,6 +1640,9 @@
if (!wpa_group_s) {
return createStatus(SupplicantStatusCode::FAILURE_IFACE_UNKNOWN);
}
+ if (bssid.size() != ETH_ALEN) {
+ return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ }
const uint8_t* bssid_addr =
is_zero_ether_addr(bssid.data()) ? nullptr : bssid.data();
#ifdef CONFIG_AP
@@ -1673,6 +1691,9 @@
if (!wpa_group_s) {
return {"", createStatus(SupplicantStatusCode::FAILURE_IFACE_UNKNOWN)};
}
+ if (bssid.size() != ETH_ALEN) {
+ return {"", createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
+ }
const uint8_t* bssid_addr =
is_zero_ether_addr(bssid.data()) ? nullptr : bssid.data();
int pin = wpas_wps_start_pin(
@@ -1705,6 +1726,9 @@
const std::vector<uint8_t>& type)
{
std::array<uint8_t, 8> type_arr;
+ if (type.size() != 8) {
+ return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ }
std::copy_n(type.begin(), 8, type_arr.begin());
return iface_config_utils::setWpsDeviceType(retrieveIfacePtr(), type_arr);
}
@@ -2097,6 +2121,9 @@
const std::vector<uint8_t>& peer_address, bool isLegacyClient)
{
struct wpa_supplicant* wpa_s = retrieveIfacePtr();
+ if (peer_address.size() != ETH_ALEN) {
+ return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
+ }
wpas_p2p_remove_client(wpa_s, peer_address.data(), isLegacyClient? 1 : 0);
return ndk::ScopedAStatus::ok();
}