Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3a5251c authored by Jack He's avatar Jack He
Browse files

JNI: Check if service name is null in createSocketChannelNative

* Otherwise, GetStringUTFChars will crash

Bug: 144191892
Fixes: 144191892
Test: toggle Bluetooth and no crash
Change-Id: I1884226ecce92601cf28a4199550afd0de18f3e9
parent aa6575ce
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1255,7 +1255,9 @@ static jint createSocketChannelNative(JNIEnv* env, jobject obj, jint type,
    goto done;
  }
  uuidBytes = env->GetByteArrayElements(uuid, nullptr);
  if (serviceName != nullptr) {
    nativeServiceName = env->GetStringUTFChars(serviceName, nullptr);
  }
  if (uuidBytes == nullptr) {
    jniThrowIOException(env, EINVAL);
    goto done;