summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Omair Kamil <okamil@google.com> 2025-03-13 16:41:21 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-13 16:41:21 -0700
commita5dfbd79f3347dae736ddbd0a3bac72c386f0795 (patch)
tree207c5130896009af6046c22a3a918b1e194ff6de
parent75fafd1776debd5f355d68df7d35eea547077abe (diff)
parent30d75162db9790f7692d95ae96e6fe189a85af80 (diff)
Merge "Peer address can be null, check for null value in jni before calling str2addr/GetStringUTFChars which may crash on some platforms if given null." into main
-rw-r--r--android/app/jni/com_android_bluetooth_gatt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/android/app/jni/com_android_bluetooth_gatt.cpp b/android/app/jni/com_android_bluetooth_gatt.cpp
index acd609f8bd..be0922c8fc 100644
--- a/android/app/jni/com_android_bluetooth_gatt.cpp
+++ b/android/app/jni/com_android_bluetooth_gatt.cpp
@@ -2353,7 +2353,11 @@ static AdvertiseParameters parseParams(JNIEnv* env, jobject i) {
p.secondary_advertising_phy = secondaryPhy;
p.scan_request_notification_enable = false;
p.own_address_type = ownAddressType;
- p.peer_address = str2addr(env, peerAddress);
+ if (peerAddress == nullptr) {
+ p.peer_address = RawAddress::kEmpty;
+ } else {
+ p.peer_address = str2addr(env, peerAddress);
+ }
p.peer_address_type = peerAddressType;
p.discoverable = isDiscoverable;
return p;