Fix OOB write possible when len equals sizeof array am: 15500502b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/broadcom/wlan/+/20770980
Change-Id: I6b5019300ef3be58c9108858572a53f01a23148e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/bcmdhd/wifi_hal/Android.bp b/bcmdhd/wifi_hal/Android.bp
new file mode 100644
index 0000000..92498f3
--- /dev/null
+++ b/bcmdhd/wifi_hal/Android.bp
@@ -0,0 +1,90 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Make the HAL library
+// ============================================================
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: [
+ "Android-Apache-2.0",
+ ],
+}
+
+soong_config_module_type_import {
+ from: "frameworks/opt/net/wifi/libwifi_hal/Android.bp",
+ module_types: ["wifi_cc_defaults"],
+}
+
+wifi_cc_defaults {
+ name: "libwifi-hal-bcm-defaults",
+ soong_config_variables: {
+ google_wifi_config_lib: {
+ shared_libs: ["google_wifi_firmware_config_version_c_wrapper"],
+ cflags: [
+ "-DGOOGLE_WIFI_FW_CONFIG_VERSION_C_WRAPPER",
+ // only for pixel feature
+ "-DRING_DUMP",
+ ],
+ },
+ },
+}
+
+cc_library_static {
+ name: "libwifi-hal-bcm",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-format",
+ "-Wno-reorder",
+ "-Wno-unused-function",
+ "-Wno-unused-parameter",
+ "-Wno-unused-private-field",
+ "-Wno-unused-variable",
+ "-Wno-unused-parameter",
+ ],
+
+ defaults: [
+ "libwifi-hal-bcm-defaults",
+ ],
+
+ header_libs: [
+ "libnetlink_iface_headers",
+ "libhardware_legacy_headers",
+ ],
+
+ shared_libs: [
+ // added for libwifi-hal-bcm
+ "libcrypto",
+ // shared_libs in libwifi-hal
+ "liblog",
+ "libnl",
+ "libutils",
+ ],
+
+ srcs: [
+ "wifi_hal.cpp",
+ "rtt.cpp",
+ "common.cpp",
+ "cpp_bindings.cpp",
+ "gscan.cpp",
+ "nan.cpp",
+ "link_layer_stats.cpp",
+ "wifi_logger.cpp",
+ "wifi_offload.cpp",
+ "twt.cpp",
+ ],
+
+ proprietary: true,
+}
diff --git a/bcmdhd/wifi_hal/Android.mk b/bcmdhd/wifi_hal/Android.mk
deleted file mode 100755
index 471c312..0000000
--- a/bcmdhd/wifi_hal/Android.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# Make the HAL library
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := \
- -Wall \
- -Werror \
- -Wno-format \
- -Wno-reorder \
- -Wno-unused-function \
- -Wno-unused-parameter \
- -Wno-unused-private-field \
- -Wno-unused-variable \
- -Wno-unused-parameter
-
-LOCAL_C_INCLUDES += \
- external/libnl/include \
- $(call include-path-for, libhardware_legacy)/hardware_legacy \
- external/wpa_supplicant_8/src/drivers
-
-LOCAL_C_INCLUDES += \
- external/boringssl/include \
- external/boringssl/src/crypto/digest \
- external/boringssl/src/crypto/evp/
-
-LOCAL_HEADER_LIBRARIES := libutils_headers liblog_headers
-
-ifneq ($(wildcard vendor/google/libraries/GoogleWifiConfigLib),)
-LOCAL_SHARED_LIBRARIES += \
- google_wifi_firmware_config_version_c_wrapper
-LOCAL_CFLAGS += -DGOOGLE_WIFI_FW_CONFIG_VERSION_C_WRAPPER
-#only for pixel feature
-LOCAL_CFLAGS += -DRING_DUMP
-endif
-
-LOCAL_SRC_FILES := \
- wifi_hal.cpp \
- rtt.cpp \
- common.cpp \
- cpp_bindings.cpp \
- gscan.cpp \
- nan.cpp \
- link_layer_stats.cpp \
- wifi_logger.cpp \
- wifi_offload.cpp \
- twt.cpp
-
-LOCAL_MODULE := libwifi-hal-bcm
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_PROPRIETARY_MODULE := true
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/bcmdhd/wifi_hal/common.cpp b/bcmdhd/wifi_hal/common.cpp
index 5a9d5ab..1a55aac 100755
--- a/bcmdhd/wifi_hal/common.cpp
+++ b/bcmdhd/wifi_hal/common.cpp
@@ -33,7 +33,7 @@
#include <netlink/socket.h>
#include <netlink/handlers.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/common.h b/bcmdhd/wifi_hal/common.h
index 379582e..4c7973b 100755
--- a/bcmdhd/wifi_hal/common.h
+++ b/bcmdhd/wifi_hal/common.h
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#ifndef __WIFI_HAL_COMMON_H__
#define __WIFI_HAL_COMMON_H__
diff --git a/bcmdhd/wifi_hal/cpp_bindings.cpp b/bcmdhd/wifi_hal/cpp_bindings.cpp
index 8b56bc0..fa120e7 100755
--- a/bcmdhd/wifi_hal/cpp_bindings.cpp
+++ b/bcmdhd/wifi_hal/cpp_bindings.cpp
@@ -36,7 +36,7 @@
#include <ctype.h>
#include <errno.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/cpp_bindings.h b/bcmdhd/wifi_hal/cpp_bindings.h
index 8b5600a..cc1c662 100755
--- a/bcmdhd/wifi_hal/cpp_bindings.h
+++ b/bcmdhd/wifi_hal/cpp_bindings.h
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "sync.h"
diff --git a/bcmdhd/wifi_hal/gscan.cpp b/bcmdhd/wifi_hal/gscan.cpp
index 995c989..19bab2b 100755
--- a/bcmdhd/wifi_hal/gscan.cpp
+++ b/bcmdhd/wifi_hal/gscan.cpp
@@ -40,7 +40,7 @@
#include <log/log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/link_layer_stats.cpp b/bcmdhd/wifi_hal/link_layer_stats.cpp
index 4de0757..04b89b5 100644
--- a/bcmdhd/wifi_hal/link_layer_stats.cpp
+++ b/bcmdhd/wifi_hal/link_layer_stats.cpp
@@ -39,7 +39,7 @@
#include <utils/Log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/nan.cpp b/bcmdhd/wifi_hal/nan.cpp
index 2dadaf8..b25a41e 100755
--- a/bcmdhd/wifi_hal/nan.cpp
+++ b/bcmdhd/wifi_hal/nan.cpp
@@ -40,13 +40,13 @@
#include <utils/Log.h>
#include <log/log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
#include "netinet/in.h"
#include "arpa/inet.h"
#include <openssl/sha.h>
-#include <openssl/evp.h>
+#include <openssl/evp.h>
#include <sys/ioctl.h>
/* Changes between incompatible Version of NAN */
diff --git a/bcmdhd/wifi_hal/rtt.cpp b/bcmdhd/wifi_hal/rtt.cpp
index 46aa868..603caf3 100644
--- a/bcmdhd/wifi_hal/rtt.cpp
+++ b/bcmdhd/wifi_hal/rtt.cpp
@@ -43,7 +43,7 @@
#include <log/log.h>
#include <utils/String8.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/twt.cpp b/bcmdhd/wifi_hal/twt.cpp
index 15bb738..e3dd5bd 100755
--- a/bcmdhd/wifi_hal/twt.cpp
+++ b/bcmdhd/wifi_hal/twt.cpp
@@ -39,7 +39,7 @@
#include <utils/Log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp
index 9a5394c..e6a14e7 100755
--- a/bcmdhd/wifi_hal/wifi_hal.cpp
+++ b/bcmdhd/wifi_hal/wifi_hal.cpp
@@ -47,10 +47,10 @@
#define LOG_TAG "WifiHAL"
#include <log/log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
+#include <hardware_legacy/rtt.h>
#include "common.h"
#include "cpp_bindings.h"
-#include "rtt.h"
#include "brcm_version.h"
#include <stdio.h>
#include <string>
diff --git a/bcmdhd/wifi_hal/wifi_logger.cpp b/bcmdhd/wifi_hal/wifi_logger.cpp
index 229dc2f..dbbcf79 100755
--- a/bcmdhd/wifi_hal/wifi_logger.cpp
+++ b/bcmdhd/wifi_hal/wifi_logger.cpp
@@ -45,7 +45,7 @@
#include <log/log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"
#include <sys/stat.h>
@@ -1079,7 +1079,7 @@
unregisterVendorHandler(GOOGLE_OUI, GOOGLE_DEBUG_RING_EVENT);
ALOGV("Hal preInit Failed to put pid= %d", result);
return result;
- }
+ }
request.attr_end(data);
diff --git a/bcmdhd/wifi_hal/wifi_offload.cpp b/bcmdhd/wifi_hal/wifi_offload.cpp
index 1702ffd..a24a882 100644
--- a/bcmdhd/wifi_hal/wifi_offload.cpp
+++ b/bcmdhd/wifi_hal/wifi_offload.cpp
@@ -42,7 +42,7 @@
#include <log/log.h>
-#include "wifi_hal.h"
+#include <hardware_legacy/wifi_hal.h>
#include "common.h"
#include "cpp_bindings.h"