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

Commit c4e9aa36 authored by Martin Brabham's avatar Martin Brabham Committed by Gerrit Code Review
Browse files

Merge "Copy all 16 bytes of the IRK"

parents 150dd7d4 d5e0f259
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -1503,7 +1503,7 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,
  jfieldID dataMaskFid = env->GetFieldID(entryClazz, "data_mask", "[B");

  for (int i = 0; i < numFilters; ++i) {
    ApcfCommand curr;
    ApcfCommand curr{};

    ScopedLocalRef<jobject> current(env,
                                    env->GetObjectArrayElement(filters, i));
@@ -1518,12 +1518,6 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,

    curr.addr_type = env->GetByteField(current.get(), addrTypeFid);

    // Zero out Apcf IRK, maybe set later if one was passed
    int j;
    for (j = 0; j < 16; j++) {
      curr.irk[j] = 0;
    }

    ScopedLocalRef<jbyteArray> irkByteArray(
        env, (jbyteArray)env->GetObjectField(current.get(), irkTypeFid));

@@ -1535,10 +1529,11 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,
        jniThrowIOException(env, EINVAL);
      }
      jbyte* irkBytes = env->GetByteArrayElements(irkByteArray.get(), NULL);
      if (irkBytes != NULL) {
        for (int j = 0; j < len; j++) {
          curr.irk[i] = irkBytes[i];
      if (irkBytes == NULL) {
        jniThrowIOException(env, EINVAL);
      }
      for (int j = 0; j < len; j++) {
        curr.irk[j] = irkBytes[j];
      }
    }