diff options
author | 2025-03-13 16:41:21 -0700 | |
---|---|---|
committer | 2025-03-13 16:41:21 -0700 | |
commit | a5dfbd79f3347dae736ddbd0a3bac72c386f0795 (patch) | |
tree | 207c5130896009af6046c22a3a918b1e194ff6de | |
parent | 75fafd1776debd5f355d68df7d35eea547077abe (diff) | |
parent | 30d75162db9790f7692d95ae96e6fe189a85af80 (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.cpp | 6 |
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; |