summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jakub Pawlowski <jpawlowski@google.com> 2018-11-30 00:29:37 -0800
committer android-build-merger <android-build-merger@google.com> 2018-11-30 00:29:37 -0800
commit520a94aa479909654c854a3f802806d3a9b9ed0c (patch)
tree5c3e4c5deaa8b8cf04283feaa639ec610be4dc17
parentbc8be72c02b8a699b8d6ef94dd37e4cd611d9568 (diff)
parent63519217e8c0682369b5b3dc11417f79b3b48b7e (diff)
Bluetooth: Check descriptors size in BluetoothHidDeviceAppSdpSettings
am: 63519217e8 Change-Id: I42a61e190fc9c37b8f19623a77b3a16ba924fc70
-rw-r--r--core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
index 237082e4cb66..2f0b44f76ffb 100644
--- a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
+++ b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java
@@ -18,6 +18,7 @@ package android.bluetooth;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.EventLog;
/**
@@ -30,6 +31,8 @@ import android.os.Parcelable;
*/
public final class BluetoothHidDeviceAppSdpSettings implements Parcelable {
+ private static final int MAX_DESCRIPTOR_SIZE = 2048;
+
private final String mName;
private final String mDescription;
private final String mProvider;
@@ -55,6 +58,12 @@ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable {
mDescription = description;
mProvider = provider;
mSubclass = subclass;
+
+ if (descriptors == null || descriptors.length > MAX_DESCRIPTOR_SIZE) {
+ EventLog.writeEvent(0x534e4554, "119819889", -1, "");
+ throw new IllegalArgumentException("descriptors must be not null and shorter than "
+ + MAX_DESCRIPTOR_SIZE);
+ }
mDescriptors = descriptors.clone();
}